Added file output. Everything seems to be working as it should