Bug fix - #14. Code refactoring.