First draft of complete functionality.