restructuring + tested redis server code