trying to conolidate code