Added toString and cleaned up other code.