Added class factories. Fixed missing commas.
Improved docs and cleaned up API and code