it's work, but need some refactoring... or restructuring