getting main function right