Cleanup and optimise parts of dB