Reorganised a few functions and added new getHTML function