Some cleanup and few fixes