Switch case and add debugging refs #49