Added a min heap and seperated code into component files.