starting refactor, setting up the directories / saving in lua instead of in C