works fine. Need to clean the code.