Added functions.R and calibrate.R