Refactored library

The wish for increased flexibility with regards to which properties could be
used as resolver caused me to reconsider most of the library. I refactored the
createChain file, using functional programming to keep sane.