merge
merge part 2
fixed some ui behavior