some code clean up and url fixes