initial version
need to test on network now, should work
working version with https