Maintainability fixes

Replaced manual array copies with System.arraycopy()
Simplified boolean logic