First major refactor
basic stuff...