Mostly debug code added. To make sure most things so far are implemented properly.