Refactor

Trying to make the code more clean