optimized version of discat