code refactoring and cleaning
scripts placed in seperate files
conflilcts resolved