cleaning/consolidating code