Refactoring code chunks to allow for further customization