updated the application to reduce code repetition and the aliasing of 'this'