[WIP][issue #178] code has been modified to be merged with authentication code, code has been cleaned, and UML pending