Needs deep testing, bugs fixed