adjusted menu position, reordered code