Bug fix
Needed to define algorithm