code for line fitting