Revised interface, completed functions.