Refactoring to match custom branch