Update functions.php

Fixed issue where add_first_and_last func would break existing classes