Adding some function stubs and cleaning code up a bit.