updated to use rect object