add nested attributes plus make code more cleaner