memory improvements by closeing all files
adds documentation for new features