fixed errors. appears to be working. will test/clean up/refactor later