code cleanup on buttons