Added size checks after inserting