wrote stuff for algorithms