Refactoring and moar safe