Created new function and added to main.c