Refactored so it is prettier