Broken work. Tryig again with another branch and a complete re-write