working now, bugs fixed