Added a new layer and taken into account updating gCount

Added a new layer and taken into account updating gCount. This new added
layer will perform the learned functions and also taken into account
updating the value of gCount.