Minor refactoring of customtrack, add test for customtrack