Really big refactor and rethink of code.