V2.0 - Code Cleaning, adding auto detection