class_define_cached and other improvements

- Joined to single file
- resorted modules
- added simple tests
- added pure documentation