Fix compile errors, reduce imports
put brackets back on if statements
manually merge PR #166