restructured scripts for better integration with ci