added appending to file
added test