Basic traits support

@camspiers have implemented support for traits. Is it ready for master branch?