changed rectangle class to implement collision detection (not done yet)