3.0 working branch

Ready for version 2.1. Cleaner and faster code using less memory.