refactored code to utilize prod where necessary