minor: remove code duplication
formatting cleanup