Addes support for traits

Like the title said added support for traits.