refactored methods to include local variables as parameters