Fixed router filtering (was completely broken)
Further cleanup and logic simplification