optimized 'database' core module