improved functionality for both client and server