reorder element generation and fix specs