Fix func calls

moved func call to be not nil and wrapped main stuff in main function
more main stuff

more main stuff