Refactor controller

Refactored the commits controller