refactored to fix ci tests