refactoring and enhancement of unit pattern repository

see issue #85