adding some loggin to least squares method