No need for this method
Correcting some parts of the code
Added printArray method to help with debugging