added methods fit and contains to rect