Hide menu on click outside, slight code cleanup