Several changes due to remarks on pull request