Fixed many small bugs, almost done