Pre-set context var prior to if block
Use 127.0.0.1 instead of localhost for Travis happiness
Cleanup and normalization