Closer but this needs a refactor