Replaced old hooks with a more dynamic approach