compilable version of main