cleaned up naming, fixed error with priorities, fixed error with writef