!empty instead if is_array. Also, didn't we have an "addAttributes" or "setAttributes" method? Might be easier than repetition.