updated rect draw, and line drawing code