Optimisation

Got rid of a bunch of ugly stuff. More maintenance to come as well as a
new feature.