Finished algorithm, but syntax off, need to fix.