updated the code to use private and public