Refactored removeAndSlice, replaceAndSlice. Thansk to Venkatesha Murthy TS for the patch. JIRA: MATH-1120