Refactored code. Now it's even less readable : D