Refactored main controller so the code verification is done through a service