fixed a few errors, still trying to resolve an infinite loop