Improved end generator

Signed-off-by: Aleksi Sapon <QcTechs@gmail.com>