Add matrix map

This is a cleaned up version of #3. Created a new branch and PR as I cleaned up commit history.