Merged Mayu's code