Code refactoring (Ahhh now I feel better)