majore refactoring and debug