First working version of server. Crypt and DB functions moved to separated file.