Fixed and cleaned. Test for all cases missing