Imported changes from syncfps branch.