Improve Rectangle figure code