fixed #15 . new class added and refactoring.