Cleaned up httpget function