some code cleaning & planning