refactored to use regexp