modularized contribute algorithm template