yet another rewrite, makes several navigation commands and layouting easier to implement