Code edits for clarity and DRY purposes