photoncounters optimization