fix name space and syntax errors
refactor sort arrays into its own methods
rename sort methods semantically
delete redundant function and add notes to variable flow