Issue #1: Initial version
Fully tested, fixed a few bugs