Some leftovers and a bit of optimization (thanks Spuds for the suggestions)

Signed-off-by: emanuele <emanuele45@gmail.com>