Adjusted main method to prepare for gui later
Changed the way NamedEntity works to make it easier to get its context, and adjusted references as needed.