big code cleanup, better docs and bugfixes

- improve internal docs, make formatting more consistent
- remove dollar signs before mixin names
- fix a variety of small bugs that worked their way in