custom RAM function
trial and error to get to memory issue