pull request #27: add improvements, worked on comments for pull request. fixed tests