modified by Takasugi