Adding saveArray functionality and fixing some problems with data
structures