This method is longer than 50 lines. Please break it into parts.