removed unnecesary array copies
readability