some not good code, for emmisions and caleries sorting