slim down some code