Fixed all corner cases i can find