coded much of the basic functionality