Refactoring done

I have my doubts if this was so necessary, but it looks cleaner now imho