improved some coding