Move default period start/end into period_range
Use sensible exit statuses
Move query logging to query_ga function