refactoring source
some fixing
testing