A new algorithm for computing staggered linear bases