set variables first before testing
Revert "print debug messages"

This reverts commit a37b33a4ca821b0156f246407330fe57b097372c.