File handling added, initial version