refactored app to replace all instance variables with locals