Mass cleanup of code. Added the begin, end operations for the individual text ranges to simplify code.