Refactored some old code..