Update master to my branch

Adds some things that I thought were already in master - smart routing, helper functions, etc.