Few minor fixes (see commit messages). Closes #15 (closed), #16 (closed), #17 (closed), #18 (closed).