modify calculation functions, add record function