modiy in place, working now, not sure if I like the implementation