1) refactored code

2) fixed bug with how the quadrants were being created