Broke out fit_functions into separate file
Fixed os detection to work on Ubuntu