fix indentation and consistency on curly braces; various refactor fixes