Keeping old api, adding middleware capability