sort method using inject, only works with integers