optimized ui and fixed some bugs