Improved server side code.