insert if statements into calculateRPC method