make subroutine for MADII design