Implemented goals and refactored profile code.