moved all php code to character.php