Made module work with Unicode/UTF-8/Latin-1, organized code, added some rules