code now works. somewhat.