First draft of rest handler