beginning to fix get tms function