Added more tests. Included debug option for debug messages.