removed hardcoding of previous directory for os x and used varient of getcwd