reworked and running fine