Fix timeout crashing
Code cleanup
Fixed formatting
Fixed log notice