Cleaned up a bit the code for the previous fixes
Added ELASTIC_IP check to shutdown task