Changed implementation of output

It now uses an actual if-test instead of an 'and' because this was causing interference when an output was placed inside another 'and' expression