improved docs and type