optimization of code and spacing