Small fixes, adding some utility functions