Added some more refactoring