buildDict Added comments and fixed EOF write

Now a beta version.