Refactored the code, added object attributesř