finalize variables
restructure everything