diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..10f642450d1a8cd3b40796d29e52f13252a408aa
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+bin
+build
+lib
+src/xml/*.hxx
+src/xml/*.cxx
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000000000000000000000000000000000000..38ef62759cd928d215d16cdf1faedaba4c609bd9
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,36 @@
+image: docker.io/labrobotica/labrobotica
+
+stages:
+  - build
+  - test
+  - deploy
+
+build-package:
+  stage: build
+  script:
+#  Uncomment to install dependencies
+#    - apt update
+#    - apt -y install iri-<package_name>-dev
+    - apt update
+    - apt -y install iri-iriutils-dev
+    - apt install -y libxerces-c-dev xsdcxx
+    - mkdir -pv build
+    - cd build
+    - cmake -D CMAKE_BUILD_TYPE=RELEASE -DCPACK_PACKAGE_VERSION=$CI_COMMIT_TAG ..
+    - make package -j $(nproc)
+  artifacts:
+    paths:
+      - build/*.deb
+    expire_in: 2 weeks
+  only:
+    - tags
+    
+update_repo:
+  stage: deploy
+  script:
+    - cd build
+    - "scp -i /root/.ssh/iriLabKeyNopwd -r *trajectory*.deb irilabo@147.83.76.226:packages/"
+    - "ssh irilabo@147.83.76.226 -i /root/.ssh/iriLabKeyNopwd -tt /home/irilabo/repo_scripts/update_repo.sh trajectory"
+  only:
+    - tags
+
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4654a5a90d7abe8c9cf36680e808010ca20d3e60..af521a7cf81e37f4521b3bc657263132aa2ee839 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,18 +9,7 @@ endif(COMMAND cmake_policy)
 
 # The project name and the type of project
 PROJECT(trajectory)
-
-SET(CPACK_PACKAGE_VERSION "1.0.0")
-SET(CPACK_PACKAGE_VERSION_MAJOR "1")
-SET(CPACK_PACKAGE_VERSION_MINOR "0")
-SET(CPACK_PACKAGE_VERSION_PATCH "0")
-IF (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
-  SET (X86 TRUE)
-  SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
-ELSE ()
-  SET (X86 FALSE)
-  SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "i386")
-ENDIF()
+SET(PACKAGE_NAME trajectory)
 
 SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin)
 SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib)
@@ -77,14 +66,28 @@ ELSE(UNIX)
   )
 ENDIF(UNIX)
 
+IF (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
+  SET (X86 TRUE)
+  SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
+ELSE ()
+  SET (X86 FALSE)
+  SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "i386")
+ENDIF()
+
 IF (UNIX)
-  SET(CPACK_PACKAGE_FILE_NAME "iri-${PROJECT_NAME}-dev-${CPACK_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
-  SET(CPACK_PACKAGE_NAME "iri-${PROJECT_NAME}-dev")
-  SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Part of IRI-laboratory libraries. More information at http://wikiri.upc.es/index.php/Robotics_Lab")
-  SET(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
+  SET(CPACK_PACKAGE_FILE_NAME "iri-${PACKAGE_NAME}-dev-${CPACK_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
+  SET(CPACK_PACKAGE_NAME "iri-${PACKAGE_NAME}-dev")
+  SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Part of IRI-laboratory libraries. More information at https://gitlab.iri.upc.edu/labrobotica/labrobotica_how_to")
+  SET(CPACK_PACKAGING_INSTALL_PREFIX /usr)
   SET(CPACK_GENERATOR "DEB")
-  SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "galenya - labrobotica@iri.upc.edu")
-  SET(CPACK_SET_DESTDIR "ON")  # Necessary because of the absolute install paths
+  SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "labrobotica - labrobotica@iri.upc.edu")
+
+# Uncomment to add the necessary mantainer scripts
+#   SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/package_scripts/preinst;${CMAKE_SOURCE_DIR}/package_scripts/postinst;${CMAKE_SOURCE_DIR}/package_scripts/prerm;${CMAKE_SOURCE_DIR}/package_scripts/postrm")
+
+# Uncomment to add dependencies comma separated
+# SET(CPACK_DEBIAN_PACKAGE_DEPENDS "iri-<package_name>-dev (>= 1.0~${DISTRIB})")
+  SET(CPACK_DEBIAN_PACKAGE_DEPENDS "iri-iriutils-dev (>= 1.0~${DISTRIB}),libxerces-c-dev (>= 1.0~${DISTRIB}), xsdcxx (>= 1.0~${DISTRIB})")
 
   INCLUDE(CPack)
 ELSE(UNIX)
diff --git a/Findtrajectory.cmake b/Findtrajectory.cmake
index 71343fae41320e4616b10ad7817d32a2d5ae7276..9d60ad01b035c6b95e9c7782e8ac8562795af8f7 100644
--- a/Findtrajectory.cmake
+++ b/Findtrajectory.cmake
@@ -1,17 +1,20 @@
 #edit the following line to add the librarie's header files
-FIND_PATH(trajectory_INCLUDE_DIR trajectory.h /usr/include/iridrivers /usr/local/include/iridrivers)
+FIND_PATH(trajectory_INCLUDE_DIRS trajectory.h trajectory_exceptions.h /usr/local/include/iri/trajectory /usr/include/iri/trajectory)
 
-FIND_LIBRARY(trajectory_LIBRARY
+FIND_LIBRARY(trajectory_LIBRARIES
     NAMES trajectory
-    PATHS /usr/lib /usr/local/lib /usr/local/lib/iridrivers) 
+    PATHS /usr/local/lib/iri/trajectory /usr/lib/iri/trajectory)
 
-IF (trajectory_INCLUDE_DIR AND trajectory_LIBRARY)
+SET(trajectory_INCLUDE_DIR ${trajectory_INCLUDE_DIRS})
+SET(trajectory_LIBRARY    ${trajectory_LIBRARIES})
+
+IF (trajectory_INCLUDE_DIRS AND trajectory_LIBRARIES)
    SET(trajectory_FOUND TRUE)
-ENDIF (trajectory_INCLUDE_DIR AND trajectory_LIBRARY)
+ENDIF (trajectory_INCLUDE_DIRS AND trajectory_LIBRARIES)
 
 IF (trajectory_FOUND)
    IF (NOT trajectory_FIND_QUIETLY)
-      MESSAGE(STATUS "Found trajectory: ${trajectory_LIBRARY}")
+      MESSAGE(STATUS "Found trajectory: ${trajectory_LIBRARIES}")
    ENDIF (NOT trajectory_FIND_QUIETLY)
 ELSE (trajectory_FOUND)
    IF (trajectory_FIND_REQUIRED)
diff --git a/ReadMe.md b/ReadMe.md
new file mode 100644
index 0000000000000000000000000000000000000000..f745c1c301f76cef0b81f4626bf6ce7463be7bd4
--- /dev/null
+++ b/ReadMe.md
@@ -0,0 +1,116 @@
+Trajectory library                         {#mainpage}
+============
+
+## Description
+
+This library provides a set of functions to execute a trajectory on a set of motors.
+
+## Installation
+
+* Add the labrobotica repository if it is not already added:
+
+``` sudo sh -c 'echo "deb [arch=amd64] http://147.83.76.226/~irilabo/packages xenial main" > /etc/apt/sources.list.d/labrobotica_repo.list' ```
+
+``` wget -O - http://147.83.76.226/~irilabo/labrobotica_repo.gpg.key | sudo apt-key add - ```
+
+* Install the package:
+
+``` sudo apt update && sudo apt install iri-trajectory-dev ```
+
+## Disclaimer  
+
+Copyright (C) 2009-2019 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
+Mantainer IRI labrobotics (labrobotica@iri.upc.edu)
+
+This package is distributed in the hope that it will be useful, but without any warranty. It is provided "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the program is with you. should the program prove defective, the GMR group does not assume the cost of any necessary servicing, repair  or correction.
+
+In no event unless required by applicable law the author will be liable to you for damages, including any general, special, incidental or consequential damages arising out of the use or inability to use the program (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the program to operate with any other programs), even if the author has been advised of the possibility of such damages.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>
+
+## For developers
+
+<details><summary>click here</summary>
+<p>
+
+## Dependencies
+
+This package requires of the following system libraries and packages
+
+ * [cmake](https://www.cmake.org "CMake's Homepage"), a cross-platform build system.
+ * [doxygen](http://www.doxygen.org "Doxygen's Homepage") and [graphviz](http://www.graphviz.org "Graphviz's Homepage") to generate the documentation.
+ * [XSD](http://wiki.codesynthesis.com/XSD "XSD wiki main page") to enable XML support.
+ * stdc++.
+
+Under linux all of these utilities are available in ready-to-use packages.
+
+Under MacOS most of the packages are available via [fink](http://www.finkproject.org/ "Fink's Homepage")
+
+This package also requires of the following IRI libraries:
+
+ * [iriutils](https://gitlab.iri.upc.edu/labrobotica/algorithms/iriutils "iriutils gitlab page"), a set of basic tools.
+
+## Compilation and installation from source
+
+Clone this repository and create a build folder inside:
+
+``` mkdir build ```
+
+Inside the build folder execute the following commands:
+
+``` cmake .. ```
+
+The default build mode is DEBUG. That is, objects and executables include debug information.
+
+The RELEASE build mode optimizes for speed. To build in this mode execute instead
+``` cmake .. -DCMAKE_BUILD_TYPE=RELEASE ```
+
+The release mode will be kept until next time cmake is executed.
+
+``` make -j $(nproc)``` 
+
+In case no errors are reported, the generated libraries (if any) will be located at the
+_lib_ folder and the executables (if any) will be located at the _bin_ folder.
+
+In order to be able to use the library, it it necessary to copy it into the system.
+To do that, execute
+
+``` make install ```
+
+as root and the shared libraries will be copied to */usr/local/lib/iri/trajectory* directory
+and the header files will be copied to */usr/local/include/iri/trajectory* dierctory. If the 
+support for XML file is enabled, all the necessary files will be copied to */usr/local/include/iri/trajectory/xml*. 
+At this point, the library may be used by any user.
+
+To remove the library from the system, exceute
+
+``` make uninstall ```
+
+as root, and all the associated files will be removed from the system.
+
+To generate the documentation execute the following command:
+
+``` make doc ```
+
+## How to use it
+
+To use this library in an other library or application, in the CMakeLists.txt file, first it is necessary to locate if the library has been installed or not using the following command
+
+``` FIND_PACKAGE(trajectory) ```
+
+In the case that the package is present, it is necessary to add the header files directory to the include directory path by using
+
+``` INCLUDE_DIRECTORIES(${trajectory_INCLUDE_DIRS}) ```
+
+and it is also necessary to link with the desired libraries by using the following command
+
+``` TARGET_LINK_LIBRARIES(<executable name> ${trajectory_LIBRARIES}) ```
+
+## Examples
+
+There is one example called _trajectory\_test_.
+ It's an example code with the basic functionalities.
+
+</p>
+</details>
diff --git a/ReadMe.txt b/ReadMe.txt
deleted file mode 100644
index eacc00871a088f1f1e50c245bcc8be9e39468028..0000000000000000000000000000000000000000
--- a/ReadMe.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (C) 2009-2010 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
-Author shernand (shernand@iri.upc.edu)
-All rights reserved.
-
-This file is part of library to execute a trajectory on a set of motors library
-library to execute a trajectory on a set of motors library is free software: you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>
-
-
diff --git a/src/trajectory.h b/include/trajectory.h
similarity index 100%
rename from src/trajectory.h
rename to include/trajectory.h
diff --git a/src/trajectory_exceptions.h b/include/trajectory_exceptions.h
similarity index 100%
rename from src/trajectory_exceptions.h
rename to include/trajectory_exceptions.h
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 29e465920bbdd375dcaee995f820c252b8d82926..41b6a7fede27b6f5d45bdc59a6dbead18873ac42 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -3,12 +3,12 @@ ADD_SUBDIRECTORY(xml)
 # driver source files
 SET(sources trajectory.cpp trajectory_exceptions.cpp)
 # application header files
-SET(headers trajectory.h trajectory_exceptions.h)
+SET(headers ../include/trajectory.h ../include/trajectory_exceptions.h)
 # locate the necessary dependencies
 FIND_PACKAGE(iriutils REQUIRED)
 # add the necessary include directories
-INCLUDE_DIRECTORIES(.)
-INCLUDE_DIRECTORIES(${iriutils_INCLUDE_DIR})
+INCLUDE_DIRECTORIES(. ../include/)
+INCLUDE_DIRECTORIES(${iriutils_INCLUDE_DIRS})
 
 SET_SOURCE_FILES_PROPERTIES(${XSD_SOURCES} PROPERTIES GENERATED 1)
 
@@ -16,15 +16,15 @@ SET_SOURCE_FILES_PROPERTIES(${XSD_SOURCES} PROPERTIES GENERATED 1)
 ADD_LIBRARY(trajectory SHARED ${sources} ${XSD_SOURCES})
 
 # link necessary libraries
-TARGET_LINK_LIBRARIES(trajectory ${XSD_LIBRARY})
-TARGET_LINK_LIBRARIES(trajectory ${iriutils_LIBRARY})
+TARGET_LINK_LIBRARIES(trajectory ${XSD_LIBRARIES})
+TARGET_LINK_LIBRARIES(trajectory ${iriutils_LIBRARIES})
 
 ADD_DEPENDENCIES(trajectory xsd_files_gen)
 
 INSTALL(TARGETS trajectory
         RUNTIME DESTINATION bin
-        LIBRARY DESTINATION lib/iridrivers
-        ARCHIVE DESTINATION lib/iridrivers)
-INSTALL(FILES ${headers} DESTINATION include/iridrivers)
+        LIBRARY DESTINATION lib/iri/${PROJECT_NAME}
+        ARCHIVE DESTINATION lib/iri/${PROJECT_NAME})
+INSTALL(FILES ${headers} DESTINATION include/iri/${PROJECT_NAME})
 INSTALL(FILES ../Findtrajectory.cmake DESTINATION ${CMAKE_ROOT}/Modules/)
 ADD_SUBDIRECTORY(examples)
diff --git a/src/xml/CMakeLists.txt b/src/xml/CMakeLists.txt
index 49639f08caf9258271ea3d082b8ab310f7b2e0cd..8de9af83fed294b0ce3837c191fc291147e9f487 100644
--- a/src/xml/CMakeLists.txt
+++ b/src/xml/CMakeLists.txt
@@ -4,14 +4,16 @@ IF(EXISTS "/usr/include/xsd/cxx")
    SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_HAVE_XSD" PARENT_SCOPE)
    SET(XSD_FOUND TRUE) 
    MESSAGE(STATUS "Found the XML library ... adding support for XML files")
-   FIND_LIBRARY(XSD_LIBRARY
+   FIND_LIBRARY(XSD_LIBRARIES
       NAMES xerces-c
       PATHS /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu/)
+   SET(XSD_LIBRARY    ${XSD_LIBRARIES})
 ELSE(EXISTS "/usr/include/xsd/cxx")
    MESSAGE(STATUS "XML library not found ... it will be impossible to handle XML files")
 ENDIF(EXISTS "/usr/include/xsd/cxx")
 
 IF(XSD_FOUND)
+   SET(XSD_LIBRARIES ${XSD_LIBRARIES} PARENT_SCOPE)
    SET(XSD_LIBRARY ${XSD_LIBRARY} PARENT_SCOPE)
    SET(XSD_FILES motion_traj_file.xsd)
 
@@ -39,7 +41,7 @@ IF(XSD_FOUND)
          DEPENDS ${XSD_PATH_FILES}
          COMMENT "Parsing the xml template file ${XSD_FILES}")
 
-      INSTALL(FILES ${XSD_PATH_FILES} DESTINATION include/iridrivers/xml)
-      INSTALL(FILES ${XSD_HEADERS_INT} DESTINATION include/iridrivers/xml)
+      INSTALL(FILES ${XSD_PATH_FILES} DESTINATION include/iri/${PROJECT_NAME}/xml)
+      INSTALL(FILES ${XSD_HEADERS_INT} DESTINATION include/iri/${PROJECT_NAME}/xml)
    ENDIF(XSD_FILES)
 ENDIF(XSD_FOUND)