Better logging and functionality