Fix algorithm bugs
Add play.lua
Bugfixes
Move stuff to lib/