Added a few flags to access options and cleaned up a memory leak