restuctured the server into a connection context, interpreter and split commands into functions