hw3 done...ugly but complete