Updated formatting to include better comments and structure