Final commit of the day.
Added some tests. Found and commented on a bug.