replaced some arrays with collections and maps