Working version after library introduction.