added some more comments. tested via curl/ssh and with env vars