Improved accuracy and fixed buffer type conversion. Also added GUI for easier debugging.