Refactorization/engines

`end` at 14, 7 is not aligned with `if` at 9, 16