more degugging
finished debug, should emulate preious version