Adding post region code writting and gap check