organized the code fixes #1