Code cleanup and commenting. Placed http declaration in the init function