added function for adding traits, updated examples and docs, added tests