re-ordering sign_in code - should fix issue #10