Completely altered the core code to fix major precision flaws.