Final build

Add database, reward functions. Fix media edit, coupon amount error.