changed theta and phi computation