Remove function rewrited and moved to model. Minor improvements