fixed more bugs. sort of works.