Fixed bugs and documentation