Added some comments, and the HLT function at the end of execution