Reworked very close to working