Improved pre-commit hook