refer to https://github.com/dongzhuoer/minir