Updated formatting and shortened code