integrate version 5 changes to the main script
remove unused files