Modularized map functions and created the Treasure class.