Refactored server-side as well