Rewrote a whole lot of the code. Now has a working menu, better fail-detection etc.