Refactored and changed formatting