Started to implement algorithm