Fixed assignment pattern and added a few tests.