debugging search and create square functions