Refactored build and run scripts.