worked on Controller class, algorithmic optimizations