just some stuffs
refactoring and adding some comments