improved error handling/checking
renamed root -> public