Added more pseudocode for client side