Added functions for calculation