Fixed race condition

Ignore-this: a2fb499911e66beb64ab0cb440d5d1dd

darcs-hash:20140402123546-56b4d-e3c5160206d2241ca3b8eedcc2f1e9cd9408048d
Simplified code

Ignore-this: fd7cddbc99b67cd62e3a9b43d32f615a

darcs-hash:20140402125051-56b4d-b9833d39731fe5a65011a74603df82c6da2d47aa
Reordered attributes

Ignore-this: c6d946b3d2954e3e55b6c1c2ac4c2da4

darcs-hash:20140402142435-b22ec-284019d5b49a1fab523f496a774493d111d99739