Modifying code to support directories