Use dynamic vars instead of passing of categories.

Fix #2.