Added checks for null, a launch parameter to set the root directory, and some other minor code cleanup