Implemented HAFF Algorithm