need test, rewrite almost whole structure