stacked code clean up, more efficient