Refactory changes to the controller module