Added debug mode, fixes #5