Issue #1: Initial version
Added some tests, simplified implementation