ADDED: useful debugging features and assertions