Cleaned Up Server Side Code