fixed according to assignment changes. Added contracts