prepare for algorithm