Making router work in both AMD and non-AMD environments