Add tests for samples of generated elements
Refactor Rake task and code generators