Dubious implementation. Working-ish.