Made some big improvements, need to fix loop problem