simplified the implementation to be inside the controller, no need for extra classes now