Better documentation and bugs fixed