possibly more efficient but certainly more stylish thanks @ali-graham