mostly got code working