reformatted and cleaned up code a bit; factored out memory access into methods
reformatted and cleaned up code a bit; factored out memory access into methods

mrallc/retro,mrallc/retro,mrallc/retro,mrallc/retro,mrallc/retro,mrallc/retro,mrallc/retro,mrallc/retro,mrallc/retro,mrallc/retro,mrallc/retro,mrallc/retro,mrallc/retro