simplify code

Thanks @sovainfo