WIP needs testing but this way it works.