Refactored and renamed code