Documenting and some clean-up