simplified structure
file functions moved to lib