Completely restructured code
Use string literals for regexp