Fixed some cs issues and use sorted