cleaned up exitflags/old print statements, function now returns exit condition