https sample
add https and code cleanup