Change layout and fix some bugs