Refactored code, and added heat map