Added more documentation.
Set modified is split into two functions and documented.
Added more documentation.