added sample calculate function