Added all necessary PHP code