Add documentation for typing and remove dead code