some code tweaking