Minor refactoring and update libraries
Minor refactoring and update libraries