Relative paths in hooks

Implement the relative path calculation