Modified Data base class

handling average calculations and checking existing files