fixed some bugs, improved layout