Refactoring/removing redundancy