Fixing lots of edge cases