Some refactoring, everythig still passing, need to add other cases that don't work...