Utility functions for vectorisation