Refactors code and adds CC

The code looks a bit neater and added the Cyclomatic complexities of our
functions abreviated as CC