Cleanup of some lua code, initial work on encounter_quests