Add check for and integrity error on too high a messagecode
Move tests into seperate directory and add logging method