changed main click handler to a funciton