adding array functionality and debug