added code to h sync gen