Move helper methods out of main file
Fix user-agent string