almost done, just need to possibly incorporate promises