I think it is done, but I still need to check some edge cases.