A bit of optimization and further dev