refactored calctest