added some logging and cleaned up styling logic