Fleshed out more functions.  Still needs testing.