working and drawing rectangle