Restructuring code for cleaner dependency injection + adding authentication on mobile