Big fixes, CND recoded, ect.

- Fixed some bugs
- Removed some unecessary code
- Recoded CND
Merge pull request #8 from MaxFF/patch-9

Big fixes, CND recoded, ect.