First move in isolating logic

I removed the setup, resize and input logic from loop, so it only sets up and listens on its channels. createFrontend should see further reduction in the future.

Unittests slightly expanded, although they contain rather "stupid" tests. I wasn't particularly creative there.

I hope this is good enough as a "first step towards simple logic and unittestability". I am happy to hear if there are any ideas or criticism towards my approach.
More magic numbers?