Code refactoring. Some issues has been rosolved.