Cleanup of helper functions