refactoring code to separate out login from selecting date from choosing best date