Fixed functions necessary for calculations