cleaned up the code, need to use OOB in next commit