more error checking, added custom files