Added error code support to router