Reworked *a lot* of code.