revise program to utilize more helper methods