added initial algorithm