Documentation polished and bugs fixed