Added new function and code