Sort and clean code