taken from https://github.com/unitedworx/AltoRouter/commit/88845699730f9d5d754c4ee739f7c602bf928a5d