Minor corrections, I should check on the algorithms laters