More formatting and removing if else blocks to replace with ternary operators