made some minor changes to structure of program