Restructuring of code for improved modules/docs

This fixes issue #11. You can now generate documentation using the new
config.ld file. It should be ran with the LDoc tool. Just run
ldoc.lua . in the project directory.