fixed bug in function of main, now just have to make it work well