Simplify & de-duplicate code