Restructured my code to be more efficient.