calculateMeld Function completed