Added msg prefixes, added error handling in conditions, extended tests