added error checks and have parts of it running