implemented rectangle intersects() and contains() functions