Move utils functions to pah.rb file

This will leave the `template.rb` more clean