Refactor helper script to not use exec command