added generate bracket function