Added checks to see if file exists, modified linux build script, code cleanup