Fixed some minor bugs and documentation updated