updated logic in .erb, fixed attributes