added debug function, added exhaustive tests for TO/FROM