Add hook for defining job states; minor cleanup