Fixed nessing issues in library. Thanks to #200
Library template nesting fixes