moved everything to one file. minor updates in code