cleaning up writing and updating code refs