Added function caching, goal validation