create common functions for buttons