moment matching code added