core implementation