Exctract some common operations from conditional blocks