improve messages and arguments checking, add maybe monad for error checking and refactor all the services