updated testing and added return type to calculate for testing purposes