migrated logic out of main into routes
Merge branch 'master' of https://github.com/mekarpeles/archive.org