Minor logic fixes.
Unit tests for maybe.