added XML docs and cleaned up