Final version. Everything seems to work properly, we still need to test, update the README and delete all the debugging sysouts and even complete the TODO's put inside the code.