Refactored source code, in order for it to be more readable