small changes, improving some code