Implemented best fit. Looks correct to me. Please confirm :)