diff --git a/.travis.yml b/.travis.yml
index 1a6d6efdb4424b0f968eec02155ea2adb15f7178..2f51ab7adc2766858e3019cd18ab902e1b066dee 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,23 +1,19 @@
-sudo : required
-
+sudo: required
+dist: trusty
+language: cpp
 compiler:
     - gcc
     - clang
+
 os:
     - linux
-    - osx
-
-allow_failure:
-    - osx
-
-osx_image : xcode8
 
 branches:
     only:
         - master
+        - chamcham
         - chennapoda
 
-
 notifications:
     email:
         recipients:
@@ -31,11 +27,27 @@ notifications:
 env:
     - CTEST_MODEL=Nightly
 
+cache: apt
 before_script:
-    - if [ "$TRAVIS_OS_NAME" == "linux" ]; then ./_travis/prepare_linux.sh ; fi
-    - if [ "$TRAVIS_OS_NAME" == "osx" ]; then ./_travis/prepare_osx.sh ; fi
-
+    - sudo apt-get update -qq
+    - sudo apt-get install libxml2-dev libbz2-dev wget
+    - sudo apt-get install libhdf5-serial-dev
+    - sudo apt-get install python-numpy python-setuptools python-networkx python-pip
+    - sudo apt-get install cmake cdbs
+    - sudo apt-get install python-suds python-matplotlib python-nose
+    - sudo apt-get install python-qt4-dev python-qt4-gl python-sip-dev libqt4-dev libopenscenegraph-dev
+    - sudo apt-get install doxygen python-sphinx python-lxml
+    - sudo apt-get install git-buildpackage
+
+install:
+    - wget http://ftp.debian.org/debian/pool/main/g/gsl/libgsl0ldbl_1.16+dfsg-2_amd64.deb -O gsl_1.16.deb
+    - sudo dpkg -i gsl_1.16.deb
+    - wget http://ftp.debian.org/debian/pool/main/g/gsl/libgsl0-dev_1.16+dfsg-2_amd64.deb -O gsl_1.16-dev.deb
+    - sudo dpkg -i gsl_1.16-dev.deb
+    - sudo apt-get install -f
+    - sudo ldconfig /usr/lib64
 
 script:
-    - if [ "$TRAVIS_OS_NAME" == "linux" ]; then ./_travis/build_on_linux.sh ; fi
-    - if [ "$TRAVIS_OS_NAME" == "osx" ]; then ./_travis/build_on_osx.sh ; fi
+    - ./.travis_build.sh
+    - sudo dpkg -i ../moose*.deb 
+    - python -c 'import moose;print(moose.version());print(moose.__file__)'
diff --git a/.travis_build.sh b/.travis_build.sh
new file mode 100755
index 0000000000000000000000000000000000000000..8d92cd1fa250ecd35699aa86aef02bfce8b72c54
--- /dev/null
+++ b/.travis_build.sh
@@ -0,0 +1,24 @@
+#!/bin/bash -
+#===============================================================================
+#
+#          FILE: .travis_build.sh
+#
+#         USAGE: ./.travis_build.sh
+#
+#   DESCRIPTION: 
+#
+#       OPTIONS: ---
+#  REQUIREMENTS: ---
+#          BUGS: ---
+#         NOTES: ---
+#        AUTHOR: Dilawar Singh (), dilawars@ncbs.res.in
+#  ORGANIZATION: NCBS Bangalore
+#       CREATED: 03/05/2018 03:49:35 PM
+#      REVISION:  ---
+#===============================================================================
+
+set -o nounset                                  # Treat unset variables as an error
+set -e -x
+PATH=/usr/bin:/usr/local/bin:$PATH
+gbp buildpackage  --git-ignore-branch --git-ignore-new -uc -us -d | tee _gbp.log
+pwd 
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6968c32f41fe9b6cad0f3944aba695070c6cf49b..def09d5795c9e91ed37c5084f890366326d77604 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,6 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8)
 
 project(moose)
-
 if(POLICY CMP0048)
     cmake_policy(SET CMP0048 OLD )
 endif(POLICY CMP0048)
@@ -10,15 +9,21 @@ endif(POLICY CMP0048)
 # version file. If GIT fails, use the previous known version.
 find_program(GIT_EXEC "git")
 message( STATUS "Looking for git ${GIT_EXEC}" )
-if( (NOT MOOSE_VERSION) AND GIT_EXEC)
+if(VERSION_MOOSE)
+    message( STATUS "MOOSE version is set to ${VERSION_MOOSE} at build time" )
+elseif(GIT_EXEC)
+    message( STATUS "Getting version by reading git tags" )
     execute_process( 
         COMMAND ${GIT_EXEC} describe --tags --long
         WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
-        OUTPUT_VARIABLE MOOSE_VERSION
+        OUTPUT_VARIABLE VERSION_MOOSE
         OUTPUT_STRIP_TRAILING_WHITESPACE
     )
 endif( )
-message( STATUS "Building version ${MOOSE_VERSION}" )
+message( STATUS "Building version ${VERSION_MOOSE}" )
+
+# Prefix
+message( STATUS "CMAKE_INSTALL_PREFIX= ${CMAKE_INSTALL_PREFIX}" )
 
 # Options to pass down to moose-core
 option(WITH_DOC "Build documentation" OFF)
@@ -28,46 +33,20 @@ option(WITH_CUDA "Use CUDA/GPU" OFF)
 option(WITH_MPI "Use MPI (experimental)" OFF)
 option(WITH_GUI "Install moose-gui. Works only with python2." ON )
 
-
-# On python3. Do not install GUI. 
+# Required packages.
 find_package(PythonInterp REQUIRED)
 if(PYTHON_VERSION_MAJOR VERSION_EQUAL 3)
-    message(STATUS "moose-gui does not support python3 yet. Disabling" )
     set(WITH_GUI OFF)
 endif( )
 
-# On debian or ubuntu, --install-layout=deb needs to be passed.
-if(UNIX AND NOT APPLE)
-    find_program(LSB_RELEASE lsb_release)
-    if(LSB_RELEASE)
-        execute_process(COMMAND ${LSB_RELEASE} -is
-            OUTPUT_VARIABLE LSB_RELEASE_ID_SHORT
-            OUTPUT_STRIP_TRAILING_WHITESPACE
-            )
-        if(${LSB_RELEASE_ID_SHORT} STREQUAL "Ubuntu" 
-                OR ${LSB_RELEASE_ID_SHORT} STREQUAL "Debian" )
-            message(STATUS "Debian based LINUX: ${LSB_RELEASE_ID_SHORT}" )
-            set(CMAKE_PYMOOSE_ARGS "-DDISTUTILS_EXTRA_ARGS=\"--install-layout=deb\"" )
-        endif( )
-    endif( )
-endif( )
-
-
 add_custom_target(moose ALL)
 
-
+## intialize paths
 set(PYMOOSE_SOURCE_DIR "${CMAKE_SOURCE_DIR}/moose-core")
 set(PYMOOSE_BUILD_DIR ${CMAKE_BINARY_DIR}/__moose-core_build)
-
-# NOTE: new setuptools does not install python module to this directory unless
-# installing into user_specified path, set PYTHONPATH to this directory. We now
-# create a bdist to this directory.
 set(PYMOOSE_INSTALL_DIR ${CMAKE_BINARY_DIR}/__moose-core_install)
 file(MAKE_DIRECTORY ${PYMOOSE_INSTALL_DIR})
 
-set(PYMOOSE_BDIST_DIR ${PYMOOSE_BUILD_DIR})
-message( STATUS "bdist directory PYMOOSE_BDIST_DIR ${PYMOOSE_BDIST_DIR}" )
-
 if(WITH_GUI)
     set(MOOSE_GUI_DIR ${CMAKE_SOURCE_DIR}/moose-gui)
     set(MOOSE_GUI_INSTALL_DIR ${CMAKE_BINARY_DIR}/__moose-gui_install)
@@ -82,23 +61,19 @@ file(MAKE_DIRECTORY ${PYMOOSE_BUILD_DIR})
 # different platform.
 set(OUTPUT_MOOSEBIN ${PYMOOSE_BUILD_DIR}/moose.bin)
 
-configure_file( ${CMAKE_SOURCE_DIR}/cmake/build_moose-core.sh.in 
-    ${CMAKE_BINARY_DIR}/build_moose-core.sh )
+configure_file( 
+    ${CMAKE_SOURCE_DIR}/cmake/build_moose-core.sh.in 
+    ${PYMOOSE_BUILD_DIR}/build_moose-core.sh 
+    )
 
 # Build pymoose module.
-add_custom_target( moose-core ALL DEPENDS ${OUTPUT_MOOSEBIN} )
-
+add_custom_target( moose-core DEPENDS ${OUTPUT_MOOSEBIN} )
 add_custom_command( OUTPUT ${OUTPUT_MOOSEBIN}
-    COMMAND MAKE=$(MAKE) bash -c ${CMAKE_BINARY_DIR}/build_moose-core.sh
-    # Note that this command requires us to be in the same directory where we
-    # want to extract the tar file.
-    COMMAND ${CMAKE_COMMAND} -E chdir ${PYMOOSE_INSTALL_DIR}
-        tar xvf ${PYMOOSE_BUILD_DIR}/pymoose-${MOOSE_VERSION}.*.tar.gz 
-    COMMENT "Building bdist and unarchiving it"
-    # VERBATIM ## WARN: Don't use VERBATIM here. The glob * in tar xvf will not
-    # work
+    COMMAND ${PYMOOSE_BUILD_DIR}/build_moose-core.sh
+    WORKING_DIRECTORY ${PYMOOSE_BUILD_DIR}
+    COMMENT "Building pymoose in ${PYMOOSE_BUILD_DIR}"
+    VERBATIM
     )
-add_dependencies(moose moose-core)
 
 if(WITH_GUI)
     # Now build moose-gui and moose-examples.
@@ -115,17 +90,17 @@ if(WITH_GUI)
         COMMAND ${PYTHON_EXECUTABLE} -m compileall -q ${MOOSE_EXAMPLE_INSTALL_DIR}
         VERBATIM
         )
+endif()
+
+add_dependencies(moose moose-core)
+
+if(WITH_GUI)
     add_dependencies(moose gui examples)
     add_dependencies(examples  gui)
 endif()
 
 
-# moose-gui
-# TODO: moose-gui should be a python module.
-set(MOOSE_GUI_DIR ${CMAKE_SOURCE_DIR}/moose-gui)
 
-# Install pymoose. Use tar.gz in PYMOOSE_BUILD_DIR and unarchive it.
-# /usr is prefixed by bdist so we need to replace it.
 install(DIRECTORY ${PYMOOSE_INSTALL_DIR}/usr/
     DESTINATION ${CMAKE_INSTALL_PREFIX}
     PATTERN ".git" EXCLUDE
@@ -133,6 +108,8 @@ install(DIRECTORY ${PYMOOSE_INSTALL_DIR}/usr/
     )
 
 if(WITH_GUI)
+    # moose-gui
+    set(MOOSE_GUI_DIR ${CMAKE_SOURCE_DIR}/moose-gui)
     install(DIRECTORY ${MOOSE_GUI_INSTALL_DIR}/
         DESTINATION lib/moose/gui
         PATTERN ".git*" EXCLUDE
@@ -146,49 +123,48 @@ if(WITH_GUI)
         PATTERN ".travis*" EXCLUDE
         PATTERN "*.pyc" EXCLUDE
         )
+
+    configure_file( ${CMAKE_SOURCE_DIR}/cmake/moose.in 
+        ${CMAKE_BINARY_DIR}/moosegui )
+    install(PROGRAMS ${CMAKE_BINARY_DIR}/moosegui DESTINATION bin)
 endif()
 
-configure_file( 
-    ${CMAKE_SOURCE_DIR}/cmake/moosegui.in
-    ${CMAKE_BINARY_DIR}/moosegui 
-    )
-install(PROGRAMS ${CMAKE_BINARY_DIR}/moosegui DESTINATION bin)
+## UNINSTALL
+add_custom_target(uninstall DEPENDS __uninstall_moose-core__ )
 
-# UNINSTALL
 add_custom_command(OUTPUT __uninstall_moose-core__
     COMMAND xargs rm -rf < install_manifest.txt
     COMMAND pip uninstall -y moose 
     COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_INSTALL_PREFIX}/bin/moose.bin
     )
-add_custom_target(uninstall DEPENDS __uninstall_moose-core__ )
 
 if(WITH_GUI)
-    add_custom_command(OUTPUT  __uninstall_moose-gui__
+    add_custom_target( __uninstall_moose-gui__ )
+    add_custom_command(TARGET __uninstall_moose-gui__ 
         COMMAND ${CMAKE_COMMAND} -E remove_directory
         ${CMAKE_INSTALL_PREFIX}/lib/moose/gui
-        COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_INSTALL_PREFIX}/bin/moose
+        COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_INSTALL_PREFIX}/bin/moosegui
         )
-    #add_dependencies( uninstall __uninstall_moose-gui__ )
+    add_dependencies( uninstall __uninstall_moose-gui__ )
 endif()
 
 ################################################################################
 # CTEST 
 #################################################################################
-enable_testing( )
-add_test( NAME test_pymoose_sanity 
-    COMMAND ${PYTHON_EXECUTABLE} -c "import moose"
-    )
-
-set_tests_properties( test_pymoose_sanity 
-    PROPERTIES ENVIRONMENT "PYTHONPATH=${PYMOOSE_BUILD_DIR}/python"
-    )
+if("${CMAKE_BUILD_TYPE}" EQUAL "DEBUG")
+    enable_testing( )
+    add_test( NAME test_pymoose_sanity 
+        COMMAND ${PYTHON_EXECUTABLE} -c "import moose"
+        )
 
-# # This test always fails when -X is not working which is usually the case on
-# # Travis and OBS.
-# if(WITH_GUI)
-#     add_test( NAME test_gui_sanity 
-#         COMMAND ${PYTHON_EXECUTABLE} ${MOOSE_GUI_INSTALL_DIR}/mgui.py 
-#         WORKING_DIRECTORY ${MOOSE_GUI_INSTALL_DIR}
-#         )
-# endif()
+    if(WITH_GUI)
+        add_test( NAME test_gui_sanity 
+            COMMAND ${PYTHON_EXECUTABLE} ${MOOSE_GUI_INSTALL_DIR}/mgui.py 
+            WORKING_DIRECTORY ${MOOSE_GUI_INSTALL_DIR}
+            )
+    endif()
 
+    set_tests_properties( test_pymoose_sanity 
+        PROPERTIES ENVIRONMENT "PYTHONPATH=${PYMOOSE_BUILD_DIR}/python"
+        )
+endif()
diff --git a/debian/changelog b/debian/changelog
index c0c7780432af2bfb26002bb751fff79cceaec304..bd52b2950921cc03ea6ee5dc7099e67dad7765d0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,15 +1,18 @@
-moose (3.2.git) UNRELEASED; urgency=medium
+moose (3.1.3ubuntu1) experimental; urgency=medium
 
-    * Nightly build. 
+  * Version bumped.
 
- -- Dilawar Singh <dilawars@ncbs.res.in>  Sat, 16 Dec 2017 10:17:08 +0530
+ -- Dilawar Singh <dilawars@ncbs.res.in>  Thu, 01 Feb 2018 12:26:15 +0530
 
-moose (3.0.2) unstable; urgency=low
+moose (3.1.2) unstable; urgency=medium
 
-  * Initial release 
-  * Feature-freeze release.
-  * trunk series. Experimental branch.
-  * 3.0.2 relase.
-  * Just packed with SBML and GSL-1.6 support.
+  * Chamcham release (3.1.x) series.
 
- -- Dilawar Singh <dilawars@ncbs.res.in>  Sun, 05 Jul 2015 13:41:58 +0530
+ -- Dilawar Singh <dilawars@ncbs.res.in>  Mon, 08 May 2017 13:43:42 +0530
+
+moose (3.1.2) unstable; urgency=low
+
+  * Bugfixes over 3.1.1
+  * Enhanced rdesigneur interface.
+
+ -- Dilawar <dilawars@ncbs.res.in>  Sat, 22 Apr 2017 13:41:58 +0530
diff --git a/debian/control b/debian/control
index a0a1af49bb3ceb8e0ac7ff82d34190d01d130380..aa3360cbab2afdf31f6ff181e201e9ec663624f1 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,7 @@ Homepage: http://moose.ncbs.res.in
 
 Package: moose
 Architecture: any
-Depends: ${shlibs:Depends},python-numpy-abi9, libhdf5-7 | libhdf5-serial-1.8.4, python-lxml, python-numpy, python-matplotlib, python-networkx, python-qt4, libgsl0ldbl
+Depends: ${misc:Depends}, ${shlibs:Depends}, ${python:Depends}
 Description: the Multiscale Object-Oriented Simulation Environment
  It is the base and numerical core for large, detailed simulations including Computational Neuroscience and Systems Biology.
  .
diff --git a/debian/install b/debian/install
index f3eed99f2351a925e2a381f52d1dff583b5b1979..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644
--- a/debian/install
+++ b/debian/install
@@ -1,3 +0,0 @@
-usr/lib/moose
-usr/lib/python*
-usr/bin/moosegui
diff --git a/debian/rules b/debian/rules
index b9f79dc0cd7a928b5f2ac09e7e1742a20df7bc4d..da3f99b809eefdb95c515e37da81515d7b052e55 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,31 +1,13 @@
 #!/usr/bin/make -f
 
-# export DH_VERBOSE=1
-
-## Here goes the debian make.
+export DH_VERBOSE=1
 
 %:
-	dh "$@" 
-
-# Override clean target.
-override_dh_auto_clean:
-	rm -rf $(BUILD_DIR_MOOSE)
+	dh "$@" --buildsystem=cmake --with-python2
 
-# consider using -DUSE_VERSIONED_DIR=ON if backporting
 override_dh_auto_configure:
-	cmake -DCMAKE_INSTALL_PREFIX=debian/tmp/usr -DCMAKE_VERSION=3.2.git
-
-override_dh_auto_build:
-	make VERBOSE=0 -j`nproc`
-
-override_dh_auto_install:
-	make install
-
-override_dh_auto_test:
-	echo "Nothing to do here"
-
-override_dh_shlibdeps:
-	dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
+	dh_auto_configure -- -DVERSION_MOOSE=3.1.3 -DCMAKE_SKIP_RPATH=ON
 
 override_dh_python2:
-	dh_python2 --no-guessing-versions
+	dh_numpy
+	dh_python2