Conditional attribute instead of if statement