splitting/simplifying code