+ fixed some varnames
+ refactoring