Big cleanup

Needs more improvement, but can be used out of the box