Simplify shell detection and hooks