improve the online logic significantly