cleanup url changing code, don't change on empty parameters
fix indentation for function form