Move view utility functions to utils