diff --git a/modules/recurlyjs/css/recurlyjs.css b/modules/recurlyjs/css/recurlyjs.css
index d8f73e3..98690b4 100644
--- a/modules/recurlyjs/css/recurlyjs.css
+++ b/modules/recurlyjs/css/recurlyjs.css
@@ -7,222 +7,494 @@
  * stylistic elements removed so as to make a more useful set of defaults that
  * may be added upon.
  */
-
-/* Default styles for the div surrounding each field iframe.*/
-/**
- * @file
- * Styling of the Recurly payment widgets. Used for new subscriptions, one-time
- * payments and billing information updates.
- *
- * This CSS is based upon the Recurly.js default theme, but with overly
- * stylistic elements removed so as to make a more useful set of defaults that
- * may be added upon.
- */
-
-/* Default styles for the div surrounding each field iframe.*/
-/* This class name is set by Recurly and can not be changed. */
-.recurly-hosted-field {
+.recurly {
+  display: block;
   position: relative;
-  width: auto;
-  height: 38px;
-  background: white;
-  border: 1px solid #c2c2c2;
-  padding: 0 0.5rem;
-  outline: none;
-  box-shadow: none;
-  border-radius: 0;
-  color: #c2c2c2;
 }
-
-/* This class name is set by Recurly and can not be changed. */
-.recurly-hosted-field-focus {
-  border-color: #2c0730;
-  color: #2c0730;
-  z-index: 10;
+.recurly .cost,
+.recurly .discount {
+  font-size: 16px;
+  text-align: right;
 }
-
-/* This class name is set by Recurly and can not be changed. */
-.recurly-hosted-field-number {
-  padding-left: 60px;
+.recurly .subscription {
+  border-radius: 9px 9px 0 0;
+  text-shadow: 0 1px 0 #fff;
+  padding-top: 20px;
+  overflow: hidden;
 }
-
-.recurlyjs-form-item__first_name {
-  display: block;
-  float: left;
-  width: 48%;
-  margin-right: 2%;
+.recurly .plan {
+  color: #333;
+  overflow: hidden;
+  position: relative;
+  zoom: 1;
 }
-
-.recurlyjs-form-item__last_name {
-  display: block;
+.recurly .plan .name {
   float: left;
-  width: 48%;
+  font-size: 32px;
+  min-width: 200px;
+  line-height: 34px;
+}
+.recurly .plan .recurring_cost {
+  float: right;
+  text-align: right;
+}
+.recurly .plan .recurring_cost .cost {
+  font-size: 32px;
+  line-height: 34px;
+}
+.recurly .plan .recurring_cost .interval {
+  font-size: 12px;
+  padding-bottom: 20px;
+}
+.recurly .coupon .discount {
+  float: right;
+  height: 34px;
+  line-height: 34px;
+  vertical-align: middle;
+}
+.recurly .error {
+  padding: 5px;
+  line-height: 22px;
+  vertical-align: middle;
+  color: #000;
+  text-shadow: 0 1px 0 #fec;
+  background: #ffc;
+  border: 1px solid #ba1;
+  box-shadow: 3px 5px 5px 0 rgba(0,0,0,0.10);
+  border-radius: 5px;
+  font-size: 13px;
+}
+.recurly .server_errors {
+  color: #fff;
+  text-shadow: 0 1px 0 #000;
+  opacity: 0;
+  margin: 20px 0;
+}
+.recurly .server_errors .error {
+  padding-left: 26px;
+  background: #ffc url("../images/error.png") no-repeat 5px 9px;
+}
+.recurly .server_errors.any {
+  opacity: 1;
+  -webkit-transition: opacity 0.5s linear;
+  -moz-transition: opacity 0.5s linear;
+}
+.recurly .contact_info,
+.recurly .billing_info,
+.recurly .accept_tos {
+  position: relative;
+  overflow: hidden;
+  zoom: 1;
+}
+.recurly .contact_info .title,
+.recurly .billing_info .title,
+.recurly #paypal-info .title,
+.recurly .accept_tos .title {
+  font-size: 16px;
+  font-weight: bold;
+  line-height: 24px;
+  margin-bottom: 20px;
+  color: #404041;
+  text-shadow: 0 1px 0 #fff;
+}
+.recurly .contact_info .credit_card,
+.recurly .billing_info .credit_card,
+.recurly .accept_tos .credit_card {
+  clear: both;
 }
-.recurlyjs-form-item__first_name input,
-.recurlyjs-form-item__last_name input {
-  max-width: 100%;
-  box-sizing:border-box;
+.recurly .contact_info {
+  border-bottom: 1px #ccc dashed;
+  margin-bottom: 20px;
 }
-
-.recurlyjs-cc-info {
+.recurly .accept_tos {
+  border-top: 1px #ccc dashed;
+  overflow: visible;
+}
+.recurly .accept_tos input[type=checkbox] {
+  display: inline;
+  line-height: 34px;
+  vertical-align: middle;
+}
+.recurly .accept_tos label {
+  margin: 0 0 0 5px;
+  display: inline;
+  line-height: 34px;
+  vertical-align: middle;
+}
+.recurly .accept_tos .field .error {
   display: block;
-  clear: both;
+  position: static;
+}
+.recurly .field {
+  display: inline;
   float: left;
-  width: 100%;
-  margin: 0 0 1em 0;
+  clear: left;
+  width: 300px;
+  position: relative;
 }
-
-.recurlyjs-form-item__number {
-  display: block;
+/*.recurly .field input[type=text] {
+  width: 288px;
+}*/
+.recurly .field.company_name {
+  margin-bottom: 0;
+}
+.recurly .field .error {
+  min-width: 128px;
+  white-space: nowrap;
+  position: absolute;
+  top: 0;
+  left: 100%;
+  margin-left: 20px;
+  z-index: 1337;
+}
+.recurly .field .placeholder {
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+  padding: 6px 6px 6px 8px;
+  line-height: normal;
+  font-weight: normal;
+  vertical-align: middle;
+  color: #999;
+  cursor: text;
+  overflow: hidden;
+  white-space: nowrap;
+  -webkit-user-select: none;
+  -khtml-user-select: none;
+  -moz-user-select: none;
+  -o-user-select: none;
+  user-select: none;
+  font-weight: 300;
+}
+.recurly .field.focus .placeholder {
+  color: #ccc;
+}
+.recurly .field.invalid .placeholder {
+  color: #a77;
+}
+.recurly .form-item.form-item-coupon-code {
+  width: 140px;
+  float: left;
+  margin-bottom: 20px;
+}
+.recurly .form-item.form-item-coupon-code input[type=text] {
+  width: 128px;
+}
+.recurly .field.first_name {
+  clear: left;
+  width: 140px;
+}
+.recurly .field.first_name input[type=text] {
+  width: 128px;
+}
+.recurly .field.first_name .error {
+  left: 300px;
+}
+.recurly .field.last_name {
+  width: 140px;
+  margin-left: 20px;
+  margin-left: 20px;
+  clear: none;
+  clear: none;
+}
+/*.recurly .field.last_name input[type=text] {
+  width: 128px;
+}*/
+.recurly .field.card_number {
+  width: 220px;
+}
+./*recurly .field.card_number input[type=text] {
+  width: 208px;
+}*/
+.recurly .field.card_number .error {
+  left: 300px;
+}
+.recurly .field.cvv {
+  width: 60px;
+  margin-left: 20px;
+  margin-left: 20px;
+  clear: none;
+  clear: none;
+}
+./*recurly .field.cvv input[type=text] {
+  width: 48px;
+}*/
+.recurly .field.expires {
+  width: 300px;
+}
+./*recurly .field.expires input[type=text] {
+  width: 288px;
+}*/
+.recurly .field.expires .title {
   float: left;
-  width: 66%;
-  min-width: 220px;
-  margin-right: 1em;
+  font-size: 13px;
+  line-height: 24px;
+  vertical-align: middle;
+  width: 59px;
 }
-
-.recurlyjs-form-item__cvv {
-  display: block;
+.recurly .field.expires .month {
   float: left;
-  width: 8%;
-  min-width: 50px;
-  margin-right: 1em;
+  width: 120px;
+  margin-left: 0;
 }
-
-.recurlyjs-form-item__month,
-.recurlyjs-form-item__year {
-  display: block;
+/*.recurly .field.expires .month input[type=text] {
+  width: 108px;
+}*/
+.recurly .field.expires .year {
   float: left;
-  width: 10%;
-  min-width: 70px;
+  margin-left: 20px;
+  width: 60px;
+}
+/*.recurly .field.expires .year input[type=text] {
+  width: 48px;
+}*/
+.recurly .field.state {
+  width: 180px;
+}
+/*.recurly .field.state input[type=text] {
+  width: 168px;
+}*/
+.recurly .field.state .error {
+  left: 300px;
+}
+.recurly .field.zip {
+  width: 100px;
+  margin-left: 20px;
+  margin-left: 20px;
+  clear: none;
+  clear: none;
+}
+/*.recurly .field.zip input[type=text] {
+  width: 88px;
+}*/
+.recurly .field.vat_number {
+  width: 140px;
+  display: none;
 }
-
-.recurlyjs-form-item__month {
-  width: 8%;
-  min-width: 50px;
+/*.recurly .field.vat_number input[type=text] {
+  width: 128px;
+}*/
+.recurly .field.vat_number.applicable {
+  display: block;
 }
-
-.recurlyjs-form-item__year {
-  margin-left: 4px;
+.recurly .only_zipstreet .zip.field,
+.recurly .only_zip .zip.field {
+  margin-left: 0;
+  clear: left;
 }
 
-.recurlyjs-icon-card {
-  display: block;
-  height: 32px;
-  width: 32px;
-  z-index: 10;
+.recurly .accepted_cards, /* Legacy Recurly.js, before .payment_method class */
+.recurly .payment_method {
   position: relative;
-  left: 10px;
-  bottom: 36px;
-  margin-bottom: -36px;
-  -ms-transform: scale(1,1);
-  /* IE 9 */
-  -webkit-transform: scale(1,1);
-  /* Chrome,Safari,Opera */
-  transform: scale(1,1);
-  -webkit-transition: scale 0.2s;
-  transition: scale 0.2s;
-  transform-origin: 50% 50%;
-  -webkit-transform-origin: 50% 50%;
+  left: 140px;
+  margin-top: -44px; /* 20px margin-bottom from .billing_info .title + 24px is height of text. */
 }
 
-.recurlyjs-icon-card__unknown {
-  background: url("../images/generic_card.png") top left no-repeat;
+.recurly .payment_method .accepted_cards {
+  left: 0;
 }
 
-.recurlyjs-icon-card__visa {
-  background: url("../images/visa.png") top left no-repeat;
+.recurly .payment_option {
+  clear: both;
 }
-
-.recurlyjs-icon-card__american_express {
-  background: url("../images/amex.png") top left no-repeat;
+.recurly .payment_option input {
+  float: left;
 }
 
-.recurlyjs-icon-card__discover {
-  background: url("../images/discover.png") top left no-repeat;
+/* If there's only one payment method, hide the radio button. */
+.recurly .payment_method .payment_option input {
+  display: none;
 }
-
-.recurlyjs-icon-card__mastercard {
-  background: url("../images/mastercard.png") top left no-repeat;
+.recurly .payment_method.multiple .payment_option input {
+  display: inline-block;
 }
 
-.recurlyjs-element__hidden {
-  display: none;
+.recurly .accepted_cards .card,
+.recurly .payment_option.paypal_option .logo {
+  background-position: right top;
+  background-repeat: no-repeat;
+  text-indent: -3000px;
+  height: 32px;
+  margin: 0 0 0 5px;
+  padding: 0;
+  float: left;
 }
 
-.recurlyjs-element {
-  font-size: 1.2em;
+.recurly .accepted_cards .card {
+  width: 32px;
 }
-
-.recurlyjs-element span {
-  font-weight: bold;
+.recurly .payment_option.paypal_option .logo {
+  background-image: url("../images/paypal.png");
+  width: 114px;
 }
 
-/* Clearfix */
-.recurlyjs-plan,
-.recurlyjs-name-wrapper,
-.recurlyjs-city-state-postal-wrapper {
-  display: block;
+.recurly .paypal .paypal_message {
   clear: both;
-  float: left;
-  width: 100%;
 }
 
-
-.recurlyjs-plan-name {
-  font-weight: bold;
+.recurly .card.mastercard {
+  background-image: url("../images/mastercard.png");
 }
-
-.recurlyjs-plan-name .recurlyjs-plan-frequency {
-  font-size: 1em;
+.recurly .card.american_express {
+  background-image: url("../images/amex.png");
 }
-
-.recurlyjs-plan-name .recurlyjs-plan-frequency,
-.recurlyjs-plan-name .recurlyjs-plan-frequency span {
-  font-style: italic;
-  font-weight: normal;
+.recurly .card.visa {
+  background-image: url("../images/visa.png");
 }
-
-.recurlyjs-plan-frequency .plan-amount {
-  font-style: normal;
+.recurly .card.discover {
+  background-image: url("../images/discover.png");
 }
-
-.recurlyjs-total {
-  margin: 1em 0 2em 0;
-  padding: 1em 0 0 0;
+.recurly .card.no_match {
+  opacity: 0.3;
 }
-
-.recurlyjs-city-state-postal-wrapper input {
-  clear: both;
-  width: 100%;
+.recurly input[type=text],
+.recurly select {
+  vertical-align: middle;
+  color: #000;
 }
-
-.recurlyjs-city-state-postal-wrapper .recurlyjs-form-item__city {
-  display: block;
-  float: left;
-  width: 30%;
-  min-width: 5em;
+.recurly input[type=text].invalid,
+.recurly select.invalid {
+  border-color: #a55;
+  background: #fee;
+  color: #311;
 }
-
-.recurlyjs-city-state-postal-wrapper .recurlyjs-form-item__state {
+.recurly input[type=text] {
   display: block;
-  float: left;
-  margin: 0 1.5em;
-  width: 10%;
-  min-width: 3em;
 }
-
-.recurlyjs-city-state-postal-wrapper .recurlyjs-form-item__postal_code {
-  display: block;
-  float: left;
-  width: 25%;
-  min-width: 5em;
+.recurly input[type=text][disabled] {
+  background: #eee;
 }
-
-.recurlyjs-form-item__vat_number {
+.recurly input[type=checkbox] {
+  color: #f00;
+}
+.recurly select {
+  color: inherit;
+  font-family: inherit;
+  width: 100%;
+}
+.recurly select > option {
+  color: inherit;
+}
+.recurly .due_now {
   clear: both;
+  position: relative;
+  overflow: hidden;
+  height: auto;
+  border-top: 1px #CCC dashed;
+  padding-top: 12px;
 }
-
-form .recurlyjs-form-item__error input,
-form .recurlyjs-form-item__error .recurly-hosted-field {
-  border: 1px solid red;
+.recurly .due_now_hidden {
+  display: none;
+}
+.recurly .due_now .tax {
+  text-align: right;
+  font-size: 16px;
+  line-height: 34px;
+  clear: right;
+}
+.recurly .due_now .title{
+  clear: both;
+  float: left;
+  font-size: 29px;
+  position: relative;
+}
+.recurly .due_now .currency-symbol,
+.recurly .due_now .total-now{
+  float: right;
+  font-size: 33px;
+  line-height: 1.3em;
+  font-weight: bold;
+  letter-spacing: 1px;
+  margin: 0;
+  position: relative;
+}
+.recurly .footer {
+  border-radius: 0px 0px 9px 9px;
+  margin: 0px;
+  padding: 20px;
+}
+.recurly.submitting .footer {
+  background: url("../images/submitting.gif") no-repeat 180px 28px;
+}
+.recurly button.submit {
+  height: 46px;
+  max-width: 600px;
+  font-size: 18px;
+  font-weight: 700;
+  color: #302106;
+  text-align: center;
+  margin-left: 0px;
+  border: 1px solid #767674;
+  background: #e7a500;
+  border-radius: 10px;
+  outline: none;
+  box-shadow: inset rgba(255,255,255,0.70) 0px 1px 0px, rgba(0,0,0,0.50) 0px 1px 3px;
+  background-image: -webkit-gradient(linear, 0% 20%, 0% 100%, from(#fecd00), to(#ce7b00));
+  background: -moz-linear-gradient(top, #fecd00, #ce7b00);
+  text-shadow: rgba(255,255,255,0.50) 0 1px 0;
+  padding: 10px 20px;
+}
+.recurly button.submit:hover {
+  color: #451;
+}
+.recurly button.submit:active {
+  top: 2px;
+  color: #302106;
+  text-shadow: rgba(255,255,255,0.57) 0 -1px 0;
+  outline: none;
+  background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#ce7b00), to(#fecd00));
+  background: -moz-linear-gradient(top, #ce7b00, #fecd00);
+  box-shadow: rgba(255,255,255,0.69) 0px -1px 0px inset, rgba(0,0,0,0.26) 0px 2px 3px;
+}
+.recurly button.submit[disabled] {
+  position: relative;
+  height: 46px;
+  max-width: 600px;
+  padding: 0 10px;
+  font-weight: 700;
+  color: #555;
+  text-shadow: rgba(255,255,255,0.57) 0 1px 0;
+  text-align: center;
+  opacity: 0.75;
+  border: 1px solid #767674;
+  background: #e7a500;
+  -moz-border-radius: 10px;
+  -webkit-border-radius: 10px;
+  border-radius: 10px;
+  -webkit-user-select: none;
+  -moz-user-select: -moz-none;
+  outline: none;
+  background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#dbd9d2), to(#999));
+  background: -moz-linear-gradient(top, #dbd9d2, #999);
+  -webkit-background-clip: padding-box;
+  -webkit-box-shadow: rgba(255,255,255,0.69) 0px 1px 0px inset, rgba(0,0,0,0.26) 0px 2px 3px;
+  box-shadow: rgba(255,255,255,0.70) 0px 1px 0px inset, rgba(0,0,0,0.27) 0px 2px 3px;
+}
+.iefail {
+  background: #666;
+  padding: 10px;
+  position: absolute;
+  top: -1%;
+  left: -1%;
+  height: 102%;
+  width: 102%;
+  z-index: 9999;
+}
+.iefail .chromeframe {
+  background: #fff;
+  border: 1px solid #ccc;
+  padding: 10px;
+}
+.iefail .chromeframe p {
+  text-align: center;
+}
+.iefail .chromeframe p.blast {
+  font-size: 1.3em;
+  font-weight: bold;
+}
+.iefail .chromeframe p a {
+  color: #4183c4;
+  text-transform: capitalize;
 }
diff --git a/modules/recurlyjs/includes/recurlyjs.pages.inc b/modules/recurlyjs/includes/recurlyjs.pages.inc
index f3f6d94..e963130 100644
--- a/modules/recurlyjs/includes/recurlyjs.pages.inc
+++ b/modules/recurlyjs/includes/recurlyjs.pages.inc
@@ -140,95 +140,34 @@ function recurlyjs_subscribe_form($form, $form_state, $entity_type, $entity, $pl
     return $form;
   }
 
-  $currency = is_null($currency) ? variable_get('recurly_default_currency', 'USD') : $currency;
-
   $form['#entity_type'] = $entity_type;
   $form['#entity'] = $entity;
   $form['#plan_code'] = $plan_code;
-  $form['#plan'] = $plan;
-  $form['#currency'] = $currency;
-
-  $form['plan'] = array(
-    '#type' => 'container',
-    '#attributes' => array(
-      'class' => array('recurlyjs-plan'),
-    ),
-  );
-
-  // Plan name, cost, and frequency.
-  foreach ($plan->unit_amount_in_cents as $unit_currency) {
-    if ($unit_currency->currencyCode === $currency) {
-      $unit_amount = recurly_format_currency($unit_currency->amount_in_cents, $unit_currency->currencyCode);
-      break;
-    }
-  }
-  $plan_name = check_plain($plan->__get('name'));
-  $frequency = '<span class="recurlyjs-element recurlyjs-plan-frequency">(' . recurly_format_price_interval($unit_amount, $plan->__get('plan_interval_length'), $plan->__get('plan_interval_unit'), TRUE) . ')</span>';
-  $form['plan']['plan_name'] = array(
-    '#markup' => '<div class="recurlyjs-element recurlyjs-plan-name">' . $plan_name . ' ' . $frequency . '</div>',
-  );
-
-  $form['pricing'] = array(
-    '#type' => '#container',
-    '#attributes' => array(
-      'class' => array('recurlyjs-pricing'),
-    ),
-  );
-  // For the recurly.Pricing() module, we need to make sure we include an input
-  // field with the plan name.
-  $form['pricing'] = array();
-  $form['pricing']['plan_code'] = array(
-    '#type' => 'hidden',
-    '#value' => $plan_code,
-    '#attributes' => array(
-      'data-recurly' => 'plan',
-    ),
-  );
-
-  // Display order summary.
-  // Setup fee. Hidden by default, populated by JS as needed.
-  $form['pricing']['plan_setup'] = array(
-    '#markup' => '<div class="recurlyjs-element recurlyjs-setup-fee recurlyjs-element__hidden">' . t('Setup fee:') . ' <span data-recurly="currency_symbol"></span><span data-recurly="setup_fee_now"></span></div>',
-  );
-
-  // Discount. Hidden by default, populated by JS as needed.
-  $form['pricing']['plan_discount'] = array(
-    '#markup' => '<div class="recurlyjs-element recurlyjs-discount recurlyjs-element__hidden">' . t('Discount:') . ' <span data-recurly="currency_symbol"></span><span data-recurly="discount_now"></span></div>',
-  );
-
-  // Sub total. Hidden by default, populated by JS as needed.
-  $form['pricing']['plan_subtotal'] = array(
-    '#markup' => '<div class="recurlyjs-element recurlyjs-subtotal recurlyjs-element recurlyjs-element__hidden">' . t('Subtotal:') . ' <span data-recurly="currency_symbol"></span><span data-recurly="subtotal_now"></span></div>',
-  );
+  $form['#currency'] = $currency ?: variable_get('recurly_default_currency', 'USD');
 
-  // Taxes. Hidden by default, populated by JS as needed.
-  $form['pricing']['plan_tax'] = array(
-    '#markup' => '<div class="recurlyjs-element recurlyjs-tax recurlyjs-element recurlyjs-element__hidden">' . t('Taxes:') . ' <span data-recurly="currency_symbol"></span><span data-recurly="tax_now"></span></div>',
-  );
-
-  // Total cost.
-  $form['pricing']['plan_total'] = array(
-    '#markup' => '<div class="recurlyjs-element recurlyjs-total recurlyjs-element">' . t('Order total:') . ' <span data-recurly="currency_symbol"></span><span data-recurly="total_now"></span></div>',
-  );
+  _recurlyjs_form_attach_js($form);
+  _recurlyjs_append_billing_fields($form);
+  _recurlyjs_append_paypal_payment_method($form);
+  $form['contact_info']['first_name']['#default_value'] = isset($entity->name)? $entity->name : '';
+  $form['contact_info']['email']['#default_value']      = isset($entity->mail)? $entity->mail : '';
 
   if (variable_get('recurlyjs_enable_coupons')) {
-    $form['coupon_code'] = array(
+    $form['order_total']['coupon_code'] = array(
       '#type' => 'textfield',
       '#title' => t('Coupon Code'),
-      '#description' => t('Recurly coupon code to be applied to subscription.'),
+      '#title_display' => 'invisible',
+      '#description' => t('If you have a coupon code enter here.'),
       '#element_validate' => array('_recurlyjs_element_validate_coupon_code'),
+      '#weight' => -200,
       '#attributes' => array(
+        'placeholder' => t('Coupon Code'),
         'data-recurly' => 'coupon',
       ),
+      '#prefix' => '<div class="coupon">',
+      '#suffix' => '<div class="discount"><label ' . t('Discount') . ':></label><span data-recurly="currency_symbol" ></span><span data-recurly="discount_now" ></span></div></div>'
     );
   }
 
-  _recurlyjs_append_billing_fields($form);
-  _recurlyjs_form_attach_js($form);
-
-  if (variable_get('recurlyjs_hide_vat_number')) {
-    $form['billing']['vat_number']['#access'] = FALSE;
-  }
   $form['actions'] = array(
     '#type' => 'actions',
   );
@@ -236,6 +175,13 @@ function recurlyjs_subscribe_form($form, $form_state, $entity_type, $entity, $pl
     '#type' => 'submit',
     '#value' => t('Purchase'),
   );
+
+  // Fix bug with form re-validation. Error "The form has become outdated. Copy
+  // any unsaved work in the form below and then reload this page."
+  // @seeo also https://www.drupal.org/node/1383918
+  // UPDATE: THIS BREAKS THE PAYPAL INTEGRATION :'( ~ Jur 04/05/16
+  // $form['#token'] = FALSE;
+
   return $form;
 }
 
@@ -247,76 +193,81 @@ function recurlyjs_subscribe_form_submit($form, &$form_state) {
   $entity = $form['#entity'];
   $plan_code = $form['#plan_code'];
   $currency = $form['#currency'];
-  $recurly_token = isset($form_state['values']['recurly-token']) ? $form_state['values']['recurly-token'] : NULL;
-  $coupon_code = isset($form_state['values']['coupon_code']) ? $form_state['values']['coupon_code'] : NULL;
+  $form_values        = $form_state['values'];
+  $recurly_token      = isset($form_values['recurly-token']) ?$form_values['recurly-token'] : NULL;
+  $coupon_code        = isset($form_values['coupon_code']) ? $form_values['coupon_code'] : NULL;
+  $recurly_email      = isset($form_values['email']) ? $form_values['email'] : '';
+  $recurly_first_name = isset($form_values['first_name']) ? $form_values['first_name'] : '';
+  $recurly_last_name  = isset($form_values['last_name']) ? $form_values['last_name'] : '';
 
   list($entity_id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
   $recurly_account = recurly_account_load(array('entity_type' => $entity_type, 'entity_id' => $entity_id));
 
   if (!$recurly_account) {
     $recurly_account = new Recurly_Account();
-    $recurly_account->first_name = check_plain($form_state['values']['first_name']);
-    $recurly_account->last_name = check_plain($form_state['values']['last_name']);
-    if ($entity_type == 'user') {
-      $recurly_account->email = $entity->mail;
-      $recurly_account->username = $entity->name;
-    }
-
     // Account code is the only property required for Recurly account creation.
-    // https://dev.recurly.com/docs/create-an-account.
+    // https://dev.recurly.com/docs/create-an-account
     $recurly_account->account_code = $entity_type . '-' . $entity_id;
+    // we must add user email and username here
+    $recurly_account->username = $recurly_first_name . (isset($recurly_last_name) ? ' ' . $recurly_last_name : '');
+    $recurly_account->email = $recurly_email;
 
-    // Allow other modules the chance to alter the new Recurly Account object
-    // before it is saved.
-    drupal_alter('recurlyjs_account', $recurly_account, $entity, $plan_code);
-  }
-
-  $subscription = new Recurly_Subscription();
-  $subscription->account = $recurly_account;
-  $subscription->plan_code = $plan_code;
-  $subscription->currency = $currency;
-  $subscription->coupon_code = $coupon_code;
+    $recurly_account->billing_info = new Recurly_BillingInfo();
+    $recurly_account->billing_info->token_id = $recurly_token;
 
-  // Allow other modules the chance to alter the new Recurly Subscription object
-  // before it is saved.
-  drupal_alter('recurlyjs_subscription', $subscription, $entity, $plan_code);
+    // Except transaction errors.
+    try {
+      $recurly_account->create();
+    }
+    catch (Recurly_Error $e) {
+      watchdog('recurlyjs', 'Received the following error: @error', array('@error' => $e->getMessage()));
+      drupal_set_message($e->getMessage(), 'error');
+      $form_state['rebuild'] = TRUE;
+      return;
+    }
+  }
 
-  // Billing info is based on the token we retrieved from the Recurly JS API
-  // and should only contain the token in this case. We add this after the above
-  // alter hook to ensure it's not modified.
-  $subscription->account->billing_info = new Recurly_BillingInfo();
-  $subscription->account->billing_info->token_id = $recurly_token;
+  // We must update biling information to set country, post code and VAT to correctly creating invoices
+  // since that info is clear by default when PayPay is used
+  if (variable_get('recurlyjs_accept_paypal', FALSE) && $form_values['use_paypal_method'] == '1') {
+    try {
+      $billing_info               = new Recurly_BillingInfo();
+      $billing_info->account_code = $entity_type . '-' . $entity_id;
+      $billing_info->first_name   = $form_values['first_name'];
+      $billing_info->last_name    = $form_values['last_name'];
+      $billing_info->country      = $form_values['country'];
+      $billing_info->zip          = $form_values['postal_code'];
+      $billing_info->vat_number   = $form_values['vat_number'];
+      $billing_info->update();
+    }
+    catch (Recurly_Error $e) {
+      drupal_set_message(t('Could not update your billing informarion.'), 'error');
+      watchdog('recurlyjs', 'Received the following error: @error', array('@error' => $e->getMessage()));
+      drupal_set_message($e->getMessage(), 'error');
+      return;
+    }
+  }
 
   try {
-    // This saves all of the data assembled above in addition to creating a new
-    // subscription record.
+    $subscription = new Recurly_Subscription();
+    $subscription->account = $recurly_account;
+    $subscription->plan_code = $plan_code;
+    $subscription->currency = $currency;
+    $subscription->coupon_code = $coupon_code;
     $subscription->create();
   }
-  catch (Recurly_ValidationError $e) {
-    // There was an error validating information in the form. For example,
-    // credit card was declined. We don't need to log these in Drupal, you can
-    // find the errors logged within Recurly.
-    drupal_set_message(t('<strong>Unable to create subscription:</strong><br/>@error', array('@error' => $e->getMessage())), 'error');
-    $form_state['rebuild'] = TRUE;
-    return;
-  }
   catch (Recurly_Error $e) {
-    // Catch any non-validation errors. This will be things like unable to
-    // contact Recurly API, or lower level errors. Display a generic message to
-    // the user letting them know there was an error and then log the detailed
-    // version. There's probably nothing a user can do to correct these errors
-    // so we don't need to display the details.
-    watchdog('recurlyjs', 'Unable to create subscription: @error', array('@error' => $e->getMessage()));
-    drupal_set_message(t('An error occured while trying to create your subscription. Please contact a site administrator.'));
+    watchdog('recurlyjs', 'Unable to create subscription. Received the following error: @error', array('@error' => $e->getMessage()));
+    drupal_set_message(t('Unable to create subscription.'), 'error');
     $form_state['rebuild'] = TRUE;
     return;
   }
 
-  // Allow other modules to react to the new subscription being created.
-  module_invoke_all('recurlyjs_new_subscription', $subscription, $entity);
-
   drupal_set_message(t('Account upgraded to @plan!', array('@plan' => $subscription->plan->name)));
 
+  // Save subscription.
+  $form_state['recurly_subscription'] = $subscription;
+
   // Save the account locally immediately so that subscriber information may
   // be retrieved when the user is directed back to the /subscription tab.
   try {
@@ -339,9 +290,6 @@ function recurlyjs_subscribe_form_submit($form, &$form_state) {
  *   The entity whose info is being updated.
  */
 function recurlyjs_update_billing_form($form, $form_state, $entity_type, $entity) {
-  // Includes iframe styling.
-  drupal_add_css(drupal_get_path('module', 'recurlyjs') . '/css/recurlyjs.css');
-
   // Initialize the Recurly client with the site-wide settings.
   if (!recurly_client_initialize()) {
     $form['error'] = array(
@@ -376,11 +324,8 @@ function recurlyjs_update_billing_form($form, $form_state, $entity_type, $entity
   $form['#entity_type'] = $entity_type;
   $form['#entity'] = $entity;
 
-  _recurlyjs_append_billing_fields($form);
   _recurlyjs_form_attach_js($form);
-
-  $form['billing']['#title'] = t('New payment information');
-
+  _recurlyjs_append_billing_fields($form);
   // Populate #default_value with existing billing info.
   $excluded_fields = array('month', 'year');
   foreach (element_children($form) as $form_element_name) {
@@ -406,34 +351,31 @@ function recurlyjs_update_billing_form($form, $form_state, $entity_type, $entity
 function recurlyjs_update_billing_submit($form, $form_state) {
   $entity_type = $form['#entity_type'];
   $entity = $form['#entity'];
-  $recurly_token = isset($form_state['values']['recurly-token']) ? $form_state['values']['recurly-token'] : NULL;
+  $form_values        = $form_state['values'];
+  $recurly_token      = isset($form_values['recurly-token']) ?$form_values['recurly-token'] : NULL;
+  $recurly_email      = isset($form_values['email']) ? $form_values['email'] : '';
+  $recurly_first_name = isset($form_values['first_name']) ? $form_values['first_name'] : '';
+  $recurly_last_name  = isset($form_values['last_name']) ? $form_values['last_name'] : '';
 
   list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
   $recurly_account = recurly_account_load(array('entity_type' => $entity_type, 'entity_id' => $id));
 
   if ($recurly_token && $recurly_account) {
     try {
+      $recurly_account_code = $recurly_account->account_code;
+      // updating user account information
+      $recurly_account            = Recurly_Account::get($recurly_account_code);
+      $recurly_account->username  = $recurly_first_name . (isset($recurly_last_name) ? ' ' . $recurly_last_name : '');
+      $recurly_account->email     = $recurly_email;
+      $recurly_account->update();
+
       $billing_info = new Recurly_BillingInfo();
-      $billing_info->account_code = $recurly_account->account_code;
+      $billing_info->account_code = $recurly_account_code;
       $billing_info->token_id = $recurly_token;
       $billing_info->update();
     }
-    catch (Recurly_ValidationError $e) {
-      // There was an error validating information in the form. For example,
-      // credit card was declined. Let the user know. These errors are logged in
-      // Recurly.
-      drupal_set_message(t('<strong>Unable to update account:</strong><br/>@error', array('@error' => $e->getMessage())), 'error');
-    }
     catch (Recurly_NotFoundError $e) {
       drupal_set_message(t('Could not find account or token is invalid or expired.'), 'error');
-      $form_state['#rebuild'] = TRUE;
-    }
-    catch (Recurly_Error $e) {
-      // Catch all other errors. Log the details, and display a message for the
-      // user.
-      watchdog('recurlyjs', 'Billing information update error: @error', array('@error' => $e->getMessage()));
-      drupal_set_message(t('An error occured while trying to update your account. Please contact a site administrator.'));
-      $form_state['#rebuild'] = TRUE;
     }
   }
 }
@@ -444,189 +386,325 @@ function recurlyjs_update_billing_submit($form, $form_state) {
  * @param array &$form
  *   A Drupal form array.
  */
-function _recurlyjs_append_billing_fields(array &$form) {
-  $form['#prefix'] = '<div class="recurly-form-wrapper">';
+function _recurlyjs_append_billing_fields(&$form) {
+  $form['#prefix'] = '<div class="recurly-form-wrapper recurly">';
   $form['#suffix'] = '</div>';
-  $form['billing'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Payment information'),
-    '#attributes' => array(
-      'class' => array('recurlyjs-billing-info'),
-    ),
-  );
+
   // recurly-element.js adds errors here upon failed validation.
   $form['errors'] = array(
     '#markup' => '<div id="recurly-form-errors"></div>',
     '#weight' => -300,
   );
 
-  $form['billing']['name'] = array(
+  // Display title with plan name and cost.
+  $form['title'] = array(
     '#type' => 'container',
+    '#attributes' => array('class' => array('plan')),
+    '#weight' => -250,
+  );
+  $form['title']['name'] = array(
+    '#theme' => 'html_tag',
+    '#tag' => 'div',
+    '#value' => '',
+    '#attributes' => array('class' => array('name')),
+  );
+  $form['title']['price'] = array(
+    '#type' => 'container',
+    '#attributes' => array('class' => array('recurring_cost')),
+  );
+  $form['title']['price']['cost'] = array(
+    '#theme' => 'html_tag',
+    '#tag' => 'div',
+    '#value' => '',
+    '#attributes' => array('class' => array('cost')),
+  );
+  $form['title']['price']['interval'] = array(
+    '#theme' => 'html_tag',
+    '#tag' => 'div',
+    '#value' => '',
+    '#attributes' => array('class' => array('interval')),
+  );
+  $form['order_total'] = array(
+    '#type' => 'container',
+    '#attributes' => array(
+      'class' => array('order-total-wrapp', 'due_now'),
+    ),
+    '#weight' => -180,
+  );
+  $form['order_total']['tax'] = array(
+    '#theme' => 'html_tag',
+    '#tag' => 'div',
+    '#value' => t('Tax') . ' :<span data-recurly="currency_symbol"></span><span data-recurly="tax_now"></span>',
+    '#attributes' => array(
+      'class' => array('tax'),
+    ),
+    '#weight' => -200,
+  );
+  $form['order_total']['title'] = array(
+    '#theme' => 'html_tag',
+    '#tag' => 'div',
+    '#value' => t('Order total'),
+    '#attributes' => array(
+      'class' => array('title'),
+    ),
+  );
+  $form['order_total']['currency_symbol'] = array(
+    '#theme' => 'html_tag',
+    '#tag' => 'span',
+    '#value' => '',
+    '#attributes' => array(
+      'class' => array('currency-symbol'),
+      'data-recurly' => 'currency_symbol'
+    ),
+  );
+  $form['order_total']['total_now'] = array(
+    '#theme' => 'html_tag',
+    '#tag' => 'span',
+    '#value' => '',
     '#attributes' => array(
-      'class' => array('recurlyjs-name-wrapper'),
+      'class' => array('total-now'),
+      'data-recurly' => 'total_now'
     ),
   );
-  $form['billing']['name']['first_name'] = array(
+  // Contact info.
+  $form['contact_info'] = array(
+    '#type' => 'container',
+    '#attributes' => array('class' => array('contact_info')),
+    '#weight' => -150,
+  );
+  $form['contact_info']['title'] = array(
+    '#theme' => 'html_tag',
+    '#tag' => 'div',
+    '#value' => t('Contact info'),
+    '#attributes' => array('class' => array('title')),
+  );
+  $form['contact_info']['first_name'] = array(
     '#type' => 'textfield',
     '#title' => t('First Name'),
+    '#title_display' => 'invisible',
     '#attributes' => array(
       'data-recurly' => 'first_name',
+      'placeholder' => t('First Name'),
     ),
-    '#prefix' => '<div class="recurlyjs-form-item__first_name">',
+//    '#after_build' => array('_recurlyjs_form_remove_element_name'),
+    '#prefix' => '<div class="field first_name">',
     '#suffix' => '</div>',
   );
-  $form['billing']['name']['last_name'] = array(
+  $form['contact_info']['last_name'] = array(
     '#type' => 'textfield',
     '#title' => t('Last Name'),
+    '#title_display' => 'invisible',
     '#attributes' => array(
       'data-recurly' => 'last_name',
+      'placeholder' => t('Last Name'),
     ),
-    '#after_build' => array('_recurlyjs_form_remove_element_name'),
-    '#prefix' => '<div class="recurlyjs-form-item__last_name">',
+//    '#after_build' => array('_recurlyjs_form_remove_element_name'),
+    '#prefix' => '<div class="field last_name">',
+    '#suffix' => '</div>',
+  );
+  $form['contact_info']['email'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Email'),
+    '#title_display' => 'invisible',
+    '#attributes' => array(
+      'placeholder' => t('Email'),
+      'data-recurly' => 'email',
+    ),
+    '#prefix' => '<div class="field email">',
     '#suffix' => '</div>',
   );
-  $form['billing']['cc_info'] = array(
+
+  // Billing info.
+  $form['billing_info'] = array(
     '#type' => 'container',
+    '#attributes' => array('class' => array('billing_info')),
+    '#weight' => -130,
+  );
+  $form['billing_info']['title'] = array(
+    '#theme' => 'html_tag',
+    '#tag' => 'div',
+    '#value' => t('Billing info'),
+    '#title_display' => 'invisible',
+    '#attributes' => array('class' => array('title')),
+  );
+  $form['billing_info']['number'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Credit Card Number'),
+    '#title_display' => 'invisible',
     '#attributes' => array(
-      'class' => array('recurlyjs-cc-info'),
+      'data-recurly' => 'number',
+      'placeholder' => t('Credit Card Number'),
     ),
+    '#after_build' => array('_recurlyjs_form_remove_element_name'),
+    '#prefix' => '<div class="field card_number">',
+    '#suffix' => '</div>',
   );
-  // Credit card fields are represented as <divs> in the DOM and Recurly.JS will
-  // dynamically replace them with an input field inside of an iFrame. In order
-  // to ensure these fields never contain data in Drupal's Form API we just add
-  // them as static markup.
-  $form['billing']['cc_info']['number'] = array(
-    '#title' => t('Card Number'),
-    '#markup' => '<label for="number">' . t('Card Number') . '</label><div data-recurly="number"></div>',
-    '#prefix' => '<div class="form-item recurlyjs-form-item__number">',
-    '#suffix' => '<span class="recurlyjs-icon-card recurlyjs-icon-card__inline recurlyjs-icon-card__unknown"></span></div>',
-  );
-  $form['billing']['cc_info']['cvv'] = array(
+  $form['billing_info']['cvv'] = array(
+    '#type' => 'textfield',
     '#title' => t('CVV'),
-    '#markup' => '<label for="cvv">' . t('CVV') . '</label><div data-recurly="cvv"></div>',
-    '#prefix' => '<div class="form-item recurlyjs-form-item__cvv">',
+    '#title_display' => 'invisible',
+    '#attributes' => array(
+      'data-recurly' => 'cvv',
+      'placeholder' => t('CVV'),
+    ),
+    '#after_build' => array('_recurlyjs_form_remove_element_name'),
+    '#prefix' => '<div class="field cvv">',
     '#suffix' => '</div>',
   );
-  $form['billing']['cc_info']['month'] = array(
-    '#title' => t('Month'),
-    '#markup' => '<label for="month">' . t('Month') . '</label><div data-recurly="month"></div>',
-    '#prefix' => '<div class="form-item recurlyjs-form-item__month">',
+  $form['billing_info']['expires'] = array(
+    '#type' => 'container',
+    '#attributes' => array('class' => array('field', 'expires')),
+  );
+  $form['billing_info']['expires']['title'] = array(
+    '#theme' => 'html_tag',
+    '#tag' => 'div',
+    '#value' => t('Expires'),
+    '#attributes' => array('class' => array('title')),
+  );
+  $month_op = array_flip(range(1, 12));
+  array_walk($month_op, function(&$item, $key) {
+    $number = str_pad($key, 2, '0', STR_PAD_LEFT);
+    $item = $number . ' - ' . date('F', mktime(0, 0, 0, $key, 10));
+  });
+  $form['billing_info']['expires']['month'] = array(
+    '#type' => 'select',
+    '#title' => t('MM'),
+    '#title_display' => 'invisible',
+    '#options' => $month_op,
+    '#attributes' => array(
+      'data-recurly' => 'month',
+    ),
+    '#after_build' => array('_recurlyjs_form_remove_element_name'),
+    '#prefix' => '<div class="month">',
     '#suffix' => '</div>',
   );
-  $form['billing']['cc_info']['year'] = array(
-    '#title' => t('Year'),
-    '#markup' => '<label for="year">' . t('Year') . '</label><div data-recurly="year"></div>',
-    '#prefix' => '<div class="form-item recurlyjs-form-item__year">',
+
+  $year_op = range(date('Y'), date('Y') + 10);
+  $form['billing_info']['expires']['year'] = array(
+    '#type' => 'select',
+    '#title' => t('YYYY'),
+    '#title_display' => 'invisible',
+    '#options' => array_combine($year_op, $year_op),
+    '#attributes' => array(
+      'data-recurly' => 'year',
+    ),
+    '#after_build' => array('_recurlyjs_form_remove_element_name'),
+    '#prefix' => '<div class="year">',
     '#suffix' => '</div>',
   );
 
-  $address_requirement = variable_get('recurlyjs_address_requirement', 'full');
-  $hide_vat_number = variable_get('recurlyjs_hide_vat_number', 0);
-
-  if (in_array($address_requirement, array('zipstreet', 'full'))) {
-    $form['billing']['address1'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Address Line 1'),
-      '#attributes' => array(
-        'data-recurly' => 'address1',
-      ),
-      '#prefix' => '<div class="recurlyjs-form-item__address1">',
-      '#suffix' => '</div>',
-      '#after_build' => array('_recurlyjs_form_remove_element_name'),
-    );
-    $form['billing']['address2'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Address Line 2'),
-      '#attributes' => array(
-        'data-recurly' => 'address2',
-      ),
-      '#prefix' => '<div class="recurlyjs-form-item__address2">',
-      '#suffix' => '</div>',
-      '#after_build' => array('_recurlyjs_form_remove_element_name'),
-    );
-  }
-
-  $form['billing']['city_state_postal'] = array(
+  $form['billing_info']['address1'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Address'),
+    '#title_display' => 'invisible',
+    '#attributes' => array(
+      'data-recurly' => 'address1',
+      'placeholder' => t('Address'),
+    ),
+    '#after_build' => array('_recurlyjs_form_remove_element_name'),
+    '#prefix' => '<div class="field address1">',
+    '#suffix' => '</div>',
+  );
+  $form['billing_info']['address2'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Apt/Suite'),
+    '#title_display' => 'invisible',
+    '#attributes' => array(
+      'data-recurly' => 'address2',
+      'placeholder' => t('Apt/Suite'),
+    ),
+    '#after_build' => array('_recurlyjs_form_remove_element_name'),
+    '#prefix' => '<div class="field address2">',
+    '#suffix' => '</div>',
+  );
+  $form['billing_info']['city'] = array(
+    '#type' => 'textfield',
+    '#title' => t('City'),
+    '#title_display' => 'invisible',
+    '#attributes' => array(
+      'data-recurly' => 'city',
+      'placeholder' => t('City'),
+    ),
+    '#after_build' => array('_recurlyjs_form_remove_element_name'),
+    '#prefix' => '<div class="field city">',
+    '#suffix' => '</div>',
+  );
+  $form['billing_info']['state_zip'] = array(
     '#type' => 'container',
+    '#attributes' => array('class' => array('state_zip')),
+  );
+  $form['billing_info']['state_zip']['state'] = array(
+    '#type' => 'textfield',
+    '#title' => t('State'),
+    '#title_display' => 'invisible',
     '#attributes' => array(
-      'class' => array('recurlyjs-city-state-postal-wrapper'),
+      'data-recurly' => 'state',
+      'placeholder' => t('State'),
     ),
+    '#after_build' => array('_recurlyjs_form_remove_element_name'),
+    '#prefix' => '<div class="field state">',
+    '#suffix' => '</div>',
+  );
+  $form['billing_info']['state_zip']['postal_code'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Zip/Postal'),
+    '#title_display' => 'invisible',
+    '#attributes' => array(
+      'data-recurly' => 'postal_code',
+      'placeholder' => t('Zip/Postal'),
+    ),
+//    '#after_build' => array('_recurlyjs_form_remove_element_name'),
+    '#prefix' => '<div class="field zip">',
+    '#suffix' => '</div>',
+  );
+  $form['billing_info']['country'] = array(
+    '#type' => 'select',
+    '#options' => _recurlyjs_get_countries(),
+    '#title' => t('Country'),
+    '#title_display' => 'invisible',
+    '#empty_option' => t('- Select country -'),
+    '#empty_value' => '_none',
+    '#attributes' => array(
+      'data-recurly' => 'country',
+    ),
+//    '#after_build' => array('_recurlyjs_form_remove_element_name'),
+    '#prefix' => '<div class="field country">',
+    '#suffix' => '</div>',
   );
 
-  if ($address_requirement == 'full') {
-    $form['billing']['city_state_postal']['city'] = array(
-      '#type' => 'textfield',
-      '#title' => t('City'),
-      '#attributes' => array(
-        'data-recurly' => 'city',
-      ),
-      '#prefix' => '<div class="recurlyjs-form-item__city">',
-      '#suffix' => '</div>',
-      '#after_build' => array('_recurlyjs_form_remove_element_name'),
-    );
-    $form['billing']['city_state_postal']['state'] = array(
-      '#type' => 'textfield',
-      '#title' => t('State'),
-      '#attributes' => array(
-        'data-recurly' => 'state',
-      ),
-      '#prefix' => '<div class="recurlyjs-form-item__state">',
-      '#suffix' => '</div>',
-      '#after_build' => array('_recurlyjs_form_remove_element_name'),
-    );
-  }
-
-  if ($address_requirement != 'none') {
-    $form['billing']['city_state_postal']['postal_code'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Postal Code'),
-      '#attributes' => array(
-        'data-recurly' => 'postal_code',
-      ),
-      '#prefix' => '<div class="recurlyjs-form-item__postal_code">',
-      '#suffix' => '</div>',
-      '#after_build' => array('_recurlyjs_form_remove_element_name'),
-    );
-  }
+  $vat_avaliable_countries = array('AT', 'BE', 'BG', 'CY', 'CZ', 'DK', 'EE', 'ES', 'FI', 'FR',
+    'DE', 'GB', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT',
+    'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK', 'HR');
 
-  if ($address_requirement == 'full') {
-    // country_get_list() requires includes/locale.inc.
-    require_once DRUPAL_ROOT . '/includes/locale.inc';
-    $form['billing']['country'] = array(
-      '#type' => 'select',
-      '#title' => t('Country'),
-      '#attributes' => array(
-        'data-recurly' => 'country',
-      ),
-      '#prefix' => '<div class="recurlyjs-form-item__country">',
-      '#suffix' => '</div>',
-      '#after_build' => array('_recurlyjs_form_remove_element_name'),
-      '#options' => country_get_list(),
-      '#empty_option' => t('Select country...'),
-    );
+  $states_vat_options = array();
+  foreach ($vat_avaliable_countries as $code) {
+    $states_vat_options[] = array('value' => $code);
   }
 
-  if (!$hide_vat_number) {
-    $form['billing']['vat_number'] = array(
-      '#type' => 'textfield',
-      '#title' => t('VAT Number'),
-      '#attributes' => array(
-        'data-recurly' => 'vat_number',
+  $form['billing_info']['vat_number'] = array(
+    '#type' => 'textfield',
+    '#title' => t('VAT Number'),
+    '#title_display' => 'invisible',
+    '#attributes' => array(
+      'data-recurly' => 'vat_number',
+      'placeholder' => t('VAT Number'),
+    ),
+//    '#after_build' => array('_recurlyjs_form_remove_element_name'),
+    '#states' => array(
+      'visible' => array(
+        ':input[data-recurly="country"]' => $states_vat_options,
       ),
-      '#prefix' => '<div class="recurlyjs-form-item__vat_number">',
-      '#suffix' => '</div>',
-      '#after_build' => array('_recurlyjs_form_remove_element_name'),
-    );
-  }
+    ),
+    '#prefix' => '<div class="field vat">',
+    '#suffix' => '</div>',
+  );
 
-  $form['billing']['tax_code'] = array(
+  $form['tax_code'] = array(
     '#type' => 'hidden',
-    '#title' => t('digital'),
+    '#value'=> 'digital',
     '#attributes' => array(
       'data-recurly' => 'tax_code',
     ),
-    '#prefix' => '<div class="recurlyjs-form-item__tax_code">',
-    '#suffix' => '</div>',
     '#after_build' => array('_recurlyjs_form_remove_element_name'),
   );
   $form['recurly-token'] = array(
diff --git a/modules/recurlyjs/recurly-element.js b/modules/recurlyjs/recurly-element.js
index df9f5bd..fe9f4f9 100644
--- a/modules/recurlyjs/recurly-element.js
+++ b/modules/recurlyjs/recurly-element.js
@@ -18,8 +18,41 @@ Drupal.behaviors.recurlyJSSubscribeForm = {
 Drupal.behaviors.recurlyJSUpdateBillingForm = {
   attach: function (context, settings) {
     $('#recurlyjs-update-billing-form').once('recurlyjs-update-billing-form', function () {
-      $(this).bind('submit', Drupal.recurly.recurlyJSTokenFormSubmit);
+      $(this).on('submit', Drupal.recurly.recurlyJSTokenFormSubmit);
+    });
+  }
+};
+
+/**
+ * Set data into form.
+ */
+Drupal.behaviors.recurlyJSFormData = {
+  attach: function (context, settings) {
+    var $form = $('.recurly-form-wrapper', context);
+    var planCode = $('input[name="plan_code"]', $form).val();
+    var pricing = recurly.Pricing();
+    // Remove drupal standart form classes.
+    $('input, select', context).removeClass('form-control');
+
+    // Set plan name and price.
+    pricing.on('set.plan', function(plan) {
+      $('.plan .name', $form).text(plan.name);
+      var price = plan.price.USD;
+      $('.recurring_cost .cost, .due_now .cost', $form).text(price.symbol + price.unit_amount.toFixed(2));
+      $('.due_now .currency-symbol', $form).text(price.symbol);
+      $('.due_now .total-now', $form).text(price.unit_amount.toFixed(2));
+      var period = plan.period;
+      $('.recurring_cost .interval', $form).text(Drupal.t('every @length @interval', {
+        '@length': period.length,
+        '@interval': period.interval
+      }));
     });
+    // Set plan.
+    pricing.plan(planCode, { quantity: 1 });
+    pricing.attach($('.recurly-form-wrapper form', context));
+    // Debug pricing and errors.
+    // pricing.on('change', function (price) { console.info(price); });
+    // pricing.on('error', function (e) { console.error(e); });
   }
 };
 
@@ -30,175 +63,95 @@ Drupal.recurly.recurlyJSTokenFormSubmit = function(event) {
   event.preventDefault();
 
   // Reset the errors display
-  Drupal.recurly.clearErrors();
-  $('.recurlyjs-form-item__error').removeClass('.recurlyjs-form-item__error');
+  $('#recurly-form-errors').html('').removeAttr( "style" );
+  $('input').removeClass('invalid');
 
   // Disable the submit button
-  $('button').attr('disabled', true);
+  $('button').prop('disabled', true);
 
   var form = this;
-  recurly.token(form, function (err, token) {
-    if (err) {
-      Drupal.recurly.recurlyJSFormError(err);
-    }
-    else {
-      form.submit();
-    }
-  });
-};
 
-/**
- * Handles form errors.
- */
-Drupal.recurly.recurlyJSFormError = function(err) {
-  var errorFields = {
-    first_name: Drupal.t('First name'),
-    last_name: Drupal.t('Last name'),
-    email: Drupal.t('Email address'),
-    number: Drupal.t('Credit Card number'),
-    postal_code: Drupal.t('Postal Code'),
-    month: Drupal.t('Expiration Month'),
-    year: Drupal.t('Expiration Year')
-  };
-
-  $('button').attr('disabled', false);
-
-  var fieldErrorsList = $.map(err.fields, function (field) {
-    // Add a class to each element with an error.
-    $('.recurlyjs-form-item__' + field).addClass('recurlyjs-form-item__error');
-    // Append a message to the list.
-    return '<li>'+ errorFields[field] +'</li>';
-  }).join('');
-
-  // Add the error message to the form within standard Drupal message markup.
-  if (typeof err.message !== 'undefined') {
-    var messageMarkup = '<div class="messages error">' + err.message + '<ul>' + fieldErrorsList + '</ul></div>';
-    $('#recurly-form-errors').html(messageMarkup);
+  // run PayPal payment method if the PayPal tab is active
+  if ($('#payment-method--paypal.active', form).length === 1) {
+    Drupal.recurly.recurlyJSPaypalPurchase(form);
+    return true;
   }
-};
-
-Drupal.recurly.clearErrors = function() {
-  $('#recurly-form-errors').html('');
-};
 
-/**
- * Update icon used in credit card number field when value of field changes.
- *
- * @param state
- *   See https://dev.recurly.com/docs/events
- */
-Drupal.recurly.recurlyJSPaymentMethod = function(state) {
-if (state.fields.number.focus == true) {
-  $('.recurlyjs-icon-card').removeClass().addClass('recurlyjs-icon-card recurlyjs-icon-card__' + state.fields.number.brand);
-}
+  if($('input[name="recurly-token"]').val()!='') {
+    form.submit();
+  } else {
+    recurly.token(form, function (err, token) {
+      if (err) {
+        Drupal.recurly.recurlyJSFormError(err);
+      }
+      else {
+        form.submit();
+      }
+    });
+  }
 };
 
 /**
- * Update order summary when pricing information changes.
- *
- * @param pricingState
- *   See https://dev.recurly.com/docs/pricing
+ * Handles submission using PayPal.
  */
-Drupal.recurly.recurlyJSPricing = function(pricingState) {
-  Drupal.recurly.clearErrors();
-
-  var displaySubtotal = false;
-  // Toggle visibility of order summary elements that may or may not be used
-  // depending on the plan.
-  // Toggle visiblity of setup fee.
-  if (parseInt(pricingState.now.setup_fee) > 0) {
-    $('.recurlyjs-setup-fee').removeClass('recurlyjs-element__hidden');
-    displaySubtotal = true;
-  }
-  else {
-    $('.recurlyjs-setup-fee').addClass('recurlyjs-element__hidden');
-  }
-
-  // Toggle visibility of discount.
-  if (parseInt(pricingState.now.discount) > 0) {
-    $('.recurlyjs-discount').removeClass('recurlyjs-element__hidden');
-    displaySubtotal = true;
-  }
-  else {
-    $('.recurlyjs-discount').addClass('recurlyjs-element__hidden');
-  }
-
-  // Toggle visibility of sub total. No need to display sub-total if none of the
-  // above are set.
-  if (displaySubtotal && parseInt(pricingState.now.subtotal) > 0) {
-    $('.recurlyjs-subtotal').removeClass('recurlyjs-element__hidden');
-  }
-  else {
-    $('.recurlyjs-subtotal').addClass('recurlyjs-element__hidden');
-  }
-
-  // Toggle visibility of taxes.
-  if (parseInt(pricingState.now.tax) > 0) {
-    $('.recurlyjs-tax').removeClass('recurlyjs-element__hidden');
-  }
-  else {
-    $('.recurlyjs-tax').addClass('recurlyjs-element__hidden');
-  }
+Drupal.recurly.recurlyJSPaypalPurchase = function(form) {
+  var opts = { description: 'Subscription using PayPal' };
+  recurly.paypal(opts, function (err, token) {
+    if (err) {
+      Drupal.recurly.recurlyJSFormError(err);
+    } else {
+      $('input[name="recurly-token"]').val(token.id);
+      $('input[name="use_paypal_method"]').val(1);
+      form.submit();
+    }
+  });
 };
 
 /**
- * Configures form for recurly hosted fields.
+ * Handles form errors.
  */
-Drupal.behaviors.recurlyJSConfigureForm = {
-  attach: function (context, settings) {
-    recurly.configure({
-      publicKey: settings.public_key,
-      style: {
-        number: {
-          placeholder: 'xxxx xxxx xxxx xxxx'
-        },
-        month: {
-          placeholder: 'MM'
-        },
-        year: {
-          placeholder: 'YYYY'
-        },
-        cvv: {
-          placeholder: '123'
+Drupal.recurly.recurlyJSFormError = function(err) {
+  $('button').prop('disabled', false);
+
+  // Add the error class to all form elements that returned an error.
+  if (typeof err.fields !== 'undefined') {
+    $('.form-item div.error').remove();
+    $('input.invalid, select.invalid').removeClass('invalid');
+    $.each(err.fields, function (index, value) {
+      var selectors = 'input[data-recurly="' + value + '"], select[data-recurly="' + value + '"]';
+      $(selectors).addClass('invalid');
+      // Added error text for empty fields.
+      if ($(selectors).val() == '') {
+        $(selectors).after('<div class="error">' + Drupal.t('Required field') + '</div>');
+      }
+      // Card number validation.
+      else if ('number' == value) {
+        if (!recurly.validate.cardNumber($(selectors).val())) {
+          $(selectors).after('<div class="error">' + Drupal.t('Invalid card number.') + '</div>');
         }
       }
-    });
-
-    // Add listener for changes to credit card field's value.
-    recurly.on('change', Drupal.recurly.recurlyJSPaymentMethod);
-
-    // Create a new pricing module, and track change events for pricing related
-    // elements on the form.
-    var pricing = recurly.Pricing();
-    pricing.attach($('#recurlyjs-subscribe-form'));
-    pricing.on('change', Drupal.recurly.recurlyJSPricing);
-    pricing.on('error', function (error) {
-      // Checking for coupon validation errors.
-      if (typeof error.message !== 'undefined') {
-        var messageMarkup = '<div class="messages error coupon">' + error.message + '</div>';
-        $('#recurly-form-errors').html(messageMarkup);
+      else if ('cvv' == value) {
+        if (!recurly.validate.cvv($(selectors).val())) {
+          $(selectors).after('<div class="error">' + Drupal.t('Invalid cvv number.') + '</div>');
+        }
       }
     });
+    // Validate expiry
+    var month = $('select[data-recurly="month"]').val();
+    var year = $('select[data-recurly="year"]').val();
+    if (month != '' && year != '') {
+      if (!recurly.validate.expiry(month, year)) {
+        $('select[data-recurly="month"], select[data-recurly="year"]').after('<div class="error">' + Drupal.t('Invalid expiry.') + '</div>');
+      }
+    }
+  }
+
+  // Add the error message to the form within standard Drupal message markup.
+  if (typeof err.message !== 'undefined') {
+    var messageMarkup = '<div class="messages error">' + err.message + '</div>';
+    $('#recurly-form-errors').html(messageMarkup).css('padding-bottom', '20px');
   }
 };
 
-// VAT is only needed for EU countries.
-(function () {
-  var country = $('#country');
-  var vatNumber = $('#vat-number');
-  var euCountries = [
-    'AT', 'BE', 'BG', 'CY', 'CZ', 'DK', 'EE', 'ES', 'FI', 'FR',
-    'DE', 'GB', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT',
-    'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK', 'HR'
-  ];
-
-  country.bind('change init', function (event) {
-    if (~euCountries.indexOf(this.value)) {
-      vatNumber.show();
-    } else {
-      vatNumber.hide();
-    }
-  }).triggerHandler('init');
-})();
 
 })(jQuery);
diff --git a/modules/recurlyjs/recurlyjs.install b/modules/recurlyjs/recurlyjs.install
index 5f55b40..bd1320f 100644
--- a/modules/recurlyjs/recurlyjs.install
+++ b/modules/recurlyjs/recurlyjs.install
@@ -32,6 +32,7 @@ function recurlyjs_uninstall() {
   variable_del('recurlyjs_enable_add_ons');
   variable_del('recurlyjs_enable_coupons');
   variable_del('recurlyjs_hide_vat_number');
+  variable_del('recurlyjs_accept_paypal');
 }
 
 /**
