Refactored server side API