format code and set initial ns to user