refactor code for easier testing; explicitly mark session as modified
misc fixes; test added
comment tests added
enable travis-ci