refactoring code
refactoring code.
now it is starting to work.