added tests for attrs
implemented attrs
minor refactoring