Use explicit self for to_str()
Remove unused imports