input handler, improved layouting