Removed  unnecessary parameters from comp_det()

Added file for unit testing
Removed some unused functions
Refactored a global variable name
more unit testing