copying most code of moe panel