improved HTTP implementation