added MOAR documentation and some code style cleanup