code reduction

removed 95% of the code