The remove function should return element removed or null.