Code review after issue 2

pull request is done after issue 2 and review.