add algorithm related code