Remove some duplication
fix layout bugs in new study