Added server functionality

Almost ready for testing