Fixed #23 and added extra debug options.