Bug fixes. Add specification document.