this still needs to be cleaned up but it close