main file + functions