Better tests with support for REM. Fixes #3