clean up code
last state storage by job url
add some more comments