Saving to File

Saving to file implemented with some other minor fixes