Organised code a bit better - still only alpha