Added functions for calculating slope.