Rewrite BufferedFile as a standalone class