Added many of the private and public functions