Better parsing of layout files

Handles empty rules and empty files better now.

Fixes #14