many updates, cleanner code