cleaning  the code. Attempt 2