Modifications to use in-memory buffer instead of files