Updated to use Plack::Request object to retrieve external IP
Don't try to check referer if it's undef