Completely rewrote everything. Also added a readme.