Cleaned up folder structure

Moved php snippets into its own folder and added a few test classes in
referral.php