TODO
added ISC license because simple and easy language
temporary hack to work around the race conditions for servers
duration argument added and fixed race condition