works using a class,immediately sorts array on initialization