refactor algorithms to work with new syntax