Second pull request with additional changes after code review

Hi Daniel,

Here is my pull request again, additional I made changes after code review.

Best regards,
Pavlo Voznenko