Remove test code
Change smarty code to php code