my solution
a better way
template
need to finish iprb