modifying g and h