Improve rectangle drawing