added file handeling