Update run.sh

cleanup the code a bit, made more functions... need to ensure all at executed at start, should not be working as is now.