Thats the same code you commented on.. refactored :)
Fixed all other cases.