Implemented all comments as far as possible.