make code more readable, update to newest form, add permit details