implemented dynamic routing