Move hooks to a separated file.
Move logic to classes.