javascript code optimization
new UI, handle empty result