refactored run script for cluster