Added front controller. Refactored old code.