Add logging
Rearranged logging
Rearranged logging