almost working, still bug with types, WIP