fixed  few issue and updated state code