Updated the code in prep for multiple monitor

I introduced some overhead in order to clean up the code and make it
more readable. I will optimize this after I implement the multiple
monitors. The overhead was about 2-3% so its very small.