Refactoring code building for reference.