file cleanup and a more well-thought code in the making