Fixed various bugs after splitting into two files
removed separate output file,