[] mostly works now still need more checks and needs testcases!