Tests added. Core fixes.