SYNR-541 + unit tests

Fixed up more caching bugs and a minor login issue.