Refactoring code, same functionality