complete core function