more methods for trail model + some fixes
Unit tests for trail functions