optimize my sql and overhaul  ui design