Full functionality - need better write-to-file