Code cleanup due to review comments

* make `user_status` more intelligent
* remove some logic from the templates
* rename `parse_error_msg` to `parsed_error_msg`
* fix up and add more tests

LMS-1387