improved Add function