Add test for Mixin creation.

Add test for Mixin creation and a little bit of code refactoring.