Make ends() work like you'd expect it to, though the implementation is a bit of a mess.