extract build directory backup in to its own method and added alot of error handling