format code and update database