some ideas for making the program more functional and unit testing friendly