Working on def core function