refactored to use core
refactored to use core