fix the numerous code smells and spelling errors