Style merging

- Fixed some issues in style merging.
- Added some tests.
Merge branch 'style-merging'