Cleaning up API logic; using promises to display loading screen