First draft of implementation, not working yet.