General fixes and formatting. Code is compilable again.