diff --git a/DESCRIPTION b/DESCRIPTION
index c5bb2bf23e76aee0739aa2ef861f73e8aee3a563..b5091b002310b0db5122a669822c5566500f487e 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
 Package: mediawikir
 Type: Package
 Title: Connects to a mediawiki instance and writes in it what you want
-Version: 0.1.0
+Version: 0.1.1
 Author: Mathieu Loiseau
 Maintainer: Mathieu Loiseau <loiseaum@univ-grenoble-alpes.fr>
 Description: It can be used to post the output of an R script directly into a mediawiki instance
@@ -9,4 +9,4 @@ License: MIT
 Encoding: UTF-8
 LazyData: true
 RoxygenNote: 6.0.1
-Imports: RCurl
+Imports: httr,R6
diff --git a/NAMESPACE b/NAMESPACE
index 6ae926839dd1829f1016a96f766d970ff184ad97..da6a87318a82859761cc46eeba6f957a1abbd619 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -1,2 +1,7 @@
 # Generated by roxygen2: do not edit by hand
 
+export(Mediawikir)
+importFrom(R6,R6Class)
+importFrom(httr,POST)
+importFrom(httr,content)
+importFrom(httr,stop_for_status)
diff --git a/R/class.R b/R/class.R
index bb7605294e801c2fb27da16ee0292ab25a0ce1d0..2c4094c67399aba9784e87c7681a23b1aca3719b 100644
--- a/R/class.R
+++ b/R/class.R
@@ -1,68 +1,95 @@
-#'A Mediawikir controller serves to connect to a mediawiki API as a registered user in order to edit automatically certain documents based on R scripts
-#'
-#'@slot url the mediawiki instance base url
-#'@slot auth_token the current token used to edit the wiki (cf. https://www.mediawiki.org/wiki/Manual:Edit_token)
-setClass("Mediawikir", representation(url = "character", user_name = "character", auth_token = "character"))
-
-setGeneric("connect", function(.Object, pass){})
-  #'Connects to mediawiki instance and gets token (to be called by constructor)
-  setMethod("connect", "Mediawikir", function(.Object, pass){
-    tryCatch(
-      { #get login token
-        query <- httr::POST(.Object@url,
-                            body = list(action="query",
-                                        meta="tokens",
-                                        type="login",
-                                        lgname = .Object@user_name,
-                                        format= "json"))
-        httr::stop_for_status(query)
-        #parse query response to retrieve token
-        response <- httr::content(query, "parsed", "application/json")
-        token <- response$query$tokens$logintoken
-        #login query
-        query <- httr::POST(.Object@url,
-                        body = list(action="clientlogin",
-                                    username = .Object@user_name,
-                                    password = pass,
-                                    logintoken = token,
-                                    loginreturnurl="http://wiki.lezinter.net",
-                                    format= "json"))
-        httr::stop_for_status(query)
-        #parse query response to make sure login worked
-        response <- httr::content(query, "parsed", "application/json")
-        if(response$clientlogin$status!="PASS"){
-          stop(paste(response$clientlogin,"\n"))
-        }
-        else{
-          return(token)
-        }
-      },
-      error = function(e)
-      {
-        print(paste("Could not login to", .Object@url, e$message))
-        token <- 0
-      }
-    )
-    return(token)
-  })
+library(R6)
 
-#'Creates a new Mediawikir object instance
+#'Mediawikir: write R output to mediawiki
 #'
-#'@param instance_url the base url for the mediawiki instance in which one wants to store R output
-#'@param user the user to which all changes to the wiki will be credited
-#'@param pass the user's password
+#'@docType class
+#'@importFrom R6 R6Class
+#'@importFrom httr POST
+#'@importFrom httr stop_for_status
+#'@importFrom httr content
+#'@export
+#'@keywords mediawiki
+#'@description A Mediawikir controller serves to connect to a mediawiki API as a registered user in order to edit automatically certain documents based on R scripts
+#'@format An \code{\link{R6Class}} generator object
+#'@return Object of \code{\link{R6Class}} with methods to interact with mediawiki instance
+#'@field url the mediawiki instance base url
+#'@field auth_token the current token used to edit the wiki (cf. https://www.mediawiki.org/wiki/Manual:Edit_token)
+#'@field page_name the page which will be modified (including its namespace)
+#'@field content the future content of \code{page_name}, which will be incrementally constructed using object methods
 #'@examples
-#' new("Mediawikir", "http://wiki.example.com", "admin", "theadmin'spassword")
-setMethod("initialize", "Mediawikir", function (.Object, instance_url, user, pass){
-  tryCatch({
-      .Object@url <- paste(instance_url,"/","api.php",sep="")
-      .Object@user_name <- user
-      .Object@auth_token=connect(.Object, pass)
-    },
-    error = function(e){
-      print(e$message)
-      .Object <- FALSE
-    }
-  )
-  return(.Object)
-})
+#'  mwHandler <- Mediawikir$new("http://my.wiki.org", "reg_user", "mypassword", "wikiPage")
+#'@section Methods:
+#'\describe{
+#'  \item{\code{initialize(instance_url, user, page, pass)}}{Creates a new Mediawikir object out of:\describe{
+#'    \item{\code{instance_url}}{The base url to the mediawiki instance}
+#'    \item{\code{user}}{The screen name of the user who will be credited for the changes in the wiki}
+#'    \item{\code{page}}{The wiki page which contains the changes}
+#'    \item{\code{pass}}{The user's password}
+#'  }}
+#'  \item{\code{connect(pass)}}{Should not be called directly (see initialize for detail)}
+#'}
+Mediawikir <- R6Class("Mediawikir",
+ public = list(
+   url = NULL,
+   user_name = NULL,
+   auth_token = NULL,
+   page_name = NULL,
+   content = "",
+   connect = function(pass){
+     "une super méthode"
+     tryCatch(
+       { #get login token
+         query <- httr::POST(self$url,
+                             body = list(action="query",
+                                         meta="tokens",
+                                         type="login",
+                                         lgname = self$user_name,
+                                         format= "json"))
+         httr::stop_for_status(query)
+         #parse query response to retrieve token
+         response <- httr::content(query, "parsed", "application/json")
+         token <- response$query$tokens$logintoken
+         #login query
+         query <- httr::POST(self$url,
+                             body = list(action="clientlogin",
+                                         username = self$user_name,
+                                         password = pass,
+                                         logintoken = token,
+                                         loginreturnurl="http://wiki.lezinter.net",
+                                         format= "json"))
+         httr::stop_for_status(query)
+         #parse query response to make sure login worked
+         response <- httr::content(query, "parsed", "application/json")
+         if(response$clientlogin$status!="PASS"){
+           stop(paste(response$clientlogin,"\n"))
+         }
+         else{
+           return(token)
+         }
+       },
+       error = function(e)
+       {
+         print(paste("Could not login to", self$url, e$message))
+         token <- 0
+       }
+     )
+     return(token)
+   },
+
+   ######
+   # initialize
+   ######
+   initialize = function (instance_url, user, page, pass){
+     tryCatch({
+       self$url <- paste(instance_url,"/","api.php",sep="")
+       self$user_name <- user
+       self$page_name <- page
+       self$auth_token <- self$connect(pass)
+     },
+     error = function(e){
+       print(e$message)
+       self <- FALSE
+     })
+   }
+ )
+)
diff --git a/man/Mediawikir-class.Rd b/man/Mediawikir-class.Rd
deleted file mode 100644
index 3d655aeaf7de0a06b3f451b1aa2aa6c7f497ab30..0000000000000000000000000000000000000000
--- a/man/Mediawikir-class.Rd
+++ /dev/null
@@ -1,17 +0,0 @@
-% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/class.R
-\docType{class}
-\name{Mediawikir-class}
-\alias{Mediawikir-class}
-\title{A Mediawikir controller serves to connect to a mediawiki API as a registered user in order to edit automatically certain documents based on R scripts}
-\description{
-A Mediawikir controller serves to connect to a mediawiki API as a registered user in order to edit automatically certain documents based on R scripts
-}
-\section{Slots}{
-
-\describe{
-\item{\code{url}}{the mediawiki instance base url}
-
-\item{\code{auth_token}}{the current token used to edit the wiki (cf. https://www.mediawiki.org/wiki/Manual:Edit_token)}
-}}
-
diff --git a/man/Mediawikir.Rd b/man/Mediawikir.Rd
new file mode 100644
index 0000000000000000000000000000000000000000..d2c6c3a4761f27d8efe8dbc8f31b262ddb3812ff
--- /dev/null
+++ b/man/Mediawikir.Rd
@@ -0,0 +1,45 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/class.R
+\docType{class}
+\name{Mediawikir}
+\alias{Mediawikir}
+\title{Mediawikir: write R output to mediawiki}
+\format{An \code{\link{R6Class}} generator object}
+\usage{
+Mediawikir
+}
+\value{
+Object of \code{\link{R6Class}} with methods to interact with mediawiki instance
+}
+\description{
+A Mediawikir controller serves to connect to a mediawiki API as a registered user in order to edit automatically certain documents based on R scripts
+}
+\section{Fields}{
+
+\describe{
+\item{\code{url}}{the mediawiki instance base url}
+
+\item{\code{auth_token}}{the current token used to edit the wiki (cf. https://www.mediawiki.org/wiki/Manual:Edit_token)}
+
+\item{\code{page_name}}{the page which will be modified (including its namespace)}
+
+\item{\code{content}}{the future content of \code{page_name}, which will be incrementally constructed using object methods}
+}}
+
+\section{Methods}{
+
+\describe{
+ \item{\code{initialize(instance_url, user, page, pass)}}{Creates a new Mediawikir object out of:\describe{
+   \item{\code{instance_url}}{The base url to the mediawiki instance}
+   \item{\code{user}}{The screen name of the user who will be credited for the changes in the wiki}
+   \item{\code{page}}{The wiki page which contains the changes}
+   \item{\code{pass}}{The user's password}
+ }}
+ \item{\code{connect(pass)}}{Should not be called directly (see initialize for detail)}
+}
+}
+
+\examples{
+ mwHandler <- Mediawikir$new("http://my.wiki.org", "reg_user", "mypassword", "wikiPage")
+}
+\keyword{mediawiki}
diff --git a/man/connect-Mediawikir-method.Rd b/man/connect-Mediawikir-method.Rd
deleted file mode 100644
index 9f6ae36463e3c77c6a8ca6e7877bd34096d7571a..0000000000000000000000000000000000000000
--- a/man/connect-Mediawikir-method.Rd
+++ /dev/null
@@ -1,12 +0,0 @@
-% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/class.R
-\docType{methods}
-\name{connect,Mediawikir-method}
-\alias{connect,Mediawikir-method}
-\title{Connects to mediawiki instance and gets token (to be called by constructor)}
-\usage{
-\S4method{connect}{Mediawikir}(.Object, pass)
-}
-\description{
-Connects to mediawiki instance and gets token (to be called by constructor)
-}
diff --git a/man/initialize-Mediawikir-method.Rd b/man/initialize-Mediawikir-method.Rd
deleted file mode 100644
index 9637bf8bfdd2e1a4de23a86d607fe25798a7b172..0000000000000000000000000000000000000000
--- a/man/initialize-Mediawikir-method.Rd
+++ /dev/null
@@ -1,22 +0,0 @@
-% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/class.R
-\docType{methods}
-\name{initialize,Mediawikir-method}
-\alias{initialize,Mediawikir-method}
-\title{Creates a new Mediawikir object instance}
-\usage{
-\S4method{initialize}{Mediawikir}(.Object, instance_url, user, pass)
-}
-\arguments{
-\item{instance_url}{the base url for the mediawiki instance in which one wants to store R output}
-
-\item{user}{the user to which all changes to the wiki will be credited}
-
-\item{pass}{the user's password}
-}
-\description{
-Creates a new Mediawikir object instance
-}
-\examples{
-new("Mediawikir", "http://wiki.example.com", "admin", "theadmin'spassword")
-}