Added contracts. Removed unneeded code.