finished with validAttributes function