cleaned up for better portability
added protected_resource as a variable
added line numbers to the output