changed controller to work with custom rect class