* mass refactoring for extension
* small bug fixing