Fixes Refactoring and Added functions