added functions for server logic.