I think its good to make related code compact. in current implementation, it could handle switch button correctly, and modes variable wont (and not need to) flow else where.