code cleanup and also added 'Save and Preview' option CRM-12965