fixed+refactoring+polishing