Fixed some bugs; simplifies output tests writing

Need to update wiki page