Changed shell to reflect the api very closely. This allows full access to each function for unit testing.