add typing and dialyze away the stupid