refactored to match latest acid version