adding avg calculation