code cleaning and minor improvements, added http examples