Cleaned up the case insensitivity code; rearranged import and from statements for better legibility.