Cleaned up controller code.
Added controller logic to services.
More code cleanup and optimization.