Clean-up code and add basic gui (WIP).