adding data calc code