Issue 586. Fixes after code-review