refactor a bit and some view tweaks