improving collection class to implement countable and arrayaccess