Refactor conditional elements