Fix some issues and improve documentation