Changed static count to real count