Refactoring and improved function names