mostly total rewrite
default back to localhost