simplified the prefix extraction