refactor dictionary format / callbacks / regex compilation