Cleaned up the code a lil bit to make it lil less repetitive.