clean up constants, merge rgit library, add some fork error handling.