Fixed up contains and bug fixes