Add local_settings to gitignore
Refactor api module. Rename functions, rewrite parts of code.
Spacing and ordering.
Fix import consistency