Re-implement attribute handling to support Readdir

Also, minor stylistic fixes and commenting.