edited algebra behind button display, more memory issues solved