huge code cleanup
huge code cleanup