moved file read/writing code for compile tasks into a library