pulling out rectangle functions and getting highlighting to work