Fixing various issues noted by Aparup Banerjee