update scripts in bin folder
code refactoring and improvements