Refactoring completed, i think :)