IO: made file loading more effecient and elegant