Added testing for main, fixed compile issues