optimization

thanks to ninjalulz