Fixed attribute validation and wrote a complete test for everything.