Fixed some bugs. Next step, try some basic caching.