Revert "replace long chain of ifs with some elifs and add 404 exception"

This reverts commit f9a64b40c48787356c424ba1df0bcd05b7061223.