Added filtering based on type and switched to "ungreedy" regex.