replaced if statement with ternary operator
removed duplicate rendering of itemview