use multiline do-end blocks and rearrange definition for clarity