WIP

In theory it's working, but the test needs to be finished and tested.