Fixed #3 (semicolon in attributes)

Also some refactorings.