Changed function name and fixed functionality