Cleaned averageFilter, added copyWithPadding and a global variable file