cleaned up w/ help from @AbrarSyed