Fix docblock typehints, remove dead code, fix formatting and other misc updates