Fix model caching and validate function to utils