Code refactoring after PCManticore sugestions.