Structural changes
Changed sync_buffer edge detection and counter implementation.