Rebased to head before pull request

PhOptimization test is now compliant with full module. Please have a look at the test and let me know your comments and suggestions.