Still a mess with some sorting