Fixed little empty array bug. Refactored tests