Added some contracts, removed some unused features and formatted the code.