Edge out all corner cases with js