File updates

Added file writing and a few small changes