added flib, 8 bit mode and various bug fixes