Further improvements
Make run_algorithm usable
Handle edge case