typos, removed unused imports, type inference and other little pedanteries