This isn't too important, but please consider cleaning up this method to make it a little more readable / understandable.