big update, fixed many flaws