added file writes to onyx.py