refactored base structure and implemented log-in flow