added console.log's to check errors