Adding better error messages, adding libraries, start refactoring of services

Adding better error messages, adding libraries, start refactoring of services