Fixed some bugs. Still doesn't produce output.