made get_f function a method and improved
made get_f function a method and improved
dealt with conflicts