cleaning code and refactory