added exceptions, main run sequence and run.sh, a shell test for functionality