add sort code and ui file