[core] Added a new function for overwriteDense. Fixed all bugs. All tests pass. Branch is stable.