Improving hook script and adding more tests