refactored rake task and created extract model