Adding Error Handeling and maxfile configuration

@jbest84 Pleas Review