Added __repr__ and __str__. Minor code edits