Changed function name and cleaned the code.