fixed saving issues/completed functionality

main functionality is complete. Not too much testing done. fixed some
saving issues where save code and save output would always create new
files