Adopted changes from core module