reworked the order in which memory is filled