general refactoring,"Bug properties" Fixed, new test, documentation updated