Tested with Mimer in addition to MySQL. Made some changes.