use opt() instead of weird regex
deleted unnecessary function