Added a couple of functions. Mostly operational except for a few errors.